mirror of
https://github.com/deadcxap/YandexMusicDiscordBot.git
synced 2026-01-12 01:51:39 +03:00
feat: Add moderation features and voting system.
This commit is contained in:
@@ -77,7 +77,8 @@ class BaseGuildsDatabase:
|
||||
current_player=None,
|
||||
is_stopped=True,
|
||||
allow_explicit=True,
|
||||
allow_menu=True,
|
||||
always_allow_menu=False,
|
||||
disable_vote=False,
|
||||
shuffle=False,
|
||||
repeat=False
|
||||
))
|
||||
|
||||
@@ -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']
|
||||
@@ -7,7 +7,8 @@ class Guild(TypedDict, total=False):
|
||||
current_player: int | None
|
||||
is_stopped: bool
|
||||
allow_explicit: bool
|
||||
allow_menu: bool
|
||||
always_allow_menu: bool
|
||||
disable_vote: bool
|
||||
shuffle: bool
|
||||
repeat: bool
|
||||
|
||||
@@ -19,6 +20,7 @@ class ExplicitGuild(TypedDict):
|
||||
current_player: int | None
|
||||
is_stopped: bool # Prevents the `after` callback of play_track
|
||||
allow_explicit: bool
|
||||
allow_menu: bool # /toggle menu is only available if there's only one user in the voice chat.
|
||||
always_allow_menu: bool
|
||||
disable_vote: bool
|
||||
shuffle: bool
|
||||
repeat: bool
|
||||
Reference in New Issue
Block a user