feat(events): add LavaLyrics events#130
Conversation
ooliver1
left a comment
There was a problem hiding this comment.
Hi! Thanks for the contribution, forgive my nitpickyness I haven't accepted many contributions on mafic before so my code has been in quite a tight style.
2 of the ruff errors in pre-commit.ci should be fixed by merging master, otherwise do check pyright and ruff outputs as that does half the reviewing for me.
Would you mind adding the other HTTP routes provided by LavaLyrics?
| ---------- | ||
| guildId: :class:`str` | ||
| The guild ID that received the lyrics line. | ||
| line: :class:`dict` |
There was a problem hiding this comment.
Could this dict instead be a TypedDict containing the fields (timestamp, duration, etc) as with the other events here. Same with the other events you've added.
| The guild ID that received event. | ||
| """ | ||
|
|
||
| __slots__ = "guildId" |
There was a problem hiding this comment.
| __slots__ = "guildId" | |
| __slots__ = ("guildId",) |
__slots__ must be a tuple, and a trailing comma is needed for a single element tuple.
| __slots__ = "guildId" | ||
|
|
||
| def __init__(self, *, guildId: str) -> None: | ||
| self.guildId: str = guildId |
There was a problem hiding this comment.
I believe a better solution is to continue to use the player in both of these events, as it is available in node.py's event handling, and also contains this guild id if required. Users can use that player to add any data they need - say to return the error to the user more efficiently.
| """ | ||
| Subscribe to Lyrics events. Requires Lavalyrics plugin to be installed. |
There was a problem hiding this comment.
| """ | |
| Subscribe to Lyrics events. Requires Lavalyrics plugin to be installed. | |
| """Subscribe to lyrics-related events. | |
| This requires the `LavaLyrics`_ plugin to be installed. | |
| .. _LavaLyrics: https://github.com/topi314/LavaLyrics/ |
| skip_track_source: | ||
| Skip the current track source and fetch from highest priority source | ||
| """ | ||
| data = await self.__request( |
There was a problem hiding this comment.
There should be no data here as it returns HTTP 204 No Content.
|
I'll try to fix(or edit) this and add all LavaLyrics http requests within a week, thanks for reply! |
# Conflicts: # mafic/events.py # mafic/node.py
# Conflicts: # mafic/events.py # mafic/node.py
…ircular import error
|
Added all LavaLyrics http routes, typing things and fixed all ruff warnings and I think pyright too |
Summary
Add custom events from LavaLyrics:
Also adds new command to subscribe to this events by aiohttp:
Checklist
task lintto format code and my changes.task pyrightand fixed the relevant issues.