feat: Add moderation features and voting system.

This commit is contained in:
Lemon4ksan
2025-01-19 14:29:13 +03:00
parent b9ea63b4d5
commit 025046a8cb
9 changed files with 328 additions and 115 deletions

View File

@@ -142,6 +142,23 @@ class VoiceGuildsDatabase(BaseGuildsDatabase):
return track
def set_current_track(self, gid: int, track: Track | dict[str, Any]) -> None:
"""Set current track.
Args:
gid (int): Guild id.
track (Track | dict[str, Any]): Track or dictionary covertable to yandex_music.Track.
"""
if isinstance(track, Track):
track = track.to_dict()
self.update(gid, {'current_track': track})
self.update(gid, {'current_track': track})
def get_current_player(self, gid: int) -> int | None:
"""Get current player.
Args:
gid (int): Guild id.
Returns: int | None: Player message id or None if not present.
"""
guild = self.get_guild(gid)
return guild['current_player']