-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat(events): add LavaLyrics events #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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?
mafic/events.py
Outdated
---------- | ||
guildId: :class:`str` | ||
The guild ID that received the lyrics line. | ||
line: :class:`dict` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
mafic/events.py
Outdated
The guild ID that received event. | ||
""" | ||
|
||
__slots__ = "guildId" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
mafic/node.py
Outdated
""" | ||
Subscribe to Lyrics events. Requires Lavalyrics plugin to be installed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
""" | |
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/ |
mafic/node.py
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 lint
to format code and my changes.task pyright
and fixed the relevant issues.