mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
Add !pause and !resume
This commit is contained in:
parent
afd3cd6bc2
commit
9359a1079c
1 changed files with 16 additions and 2 deletions
|
@ -288,7 +288,9 @@ class RoyalDiscordBot(discord.Client):
|
||||||
"!fp": self.cmd_forceplay,
|
"!fp": self.cmd_forceplay,
|
||||||
"!radiomessages": self.cmd_radiomessages,
|
"!radiomessages": self.cmd_radiomessages,
|
||||||
"!yes": self.null,
|
"!yes": self.null,
|
||||||
"!no": self.null
|
"!no": self.null,
|
||||||
|
"!pause": self.cmd_pause,
|
||||||
|
"!resume": self.cmd_resume
|
||||||
}
|
}
|
||||||
self.video_queue: typing.List[Video] = []
|
self.video_queue: typing.List[Video] = []
|
||||||
self.now_playing = None
|
self.now_playing = None
|
||||||
|
@ -727,7 +729,19 @@ class RoyalDiscordBot(discord.Client):
|
||||||
@command
|
@command
|
||||||
@requires_connected_voice_client
|
@requires_connected_voice_client
|
||||||
async def cmd_pause(self, channel: discord.TextChannel, author: discord.Member, params: typing.List[str]):
|
async def cmd_pause(self, channel: discord.TextChannel, author: discord.Member, params: typing.List[str]):
|
||||||
pass
|
for voice_client in self.voice_clients:
|
||||||
|
if voice_client.is_playing():
|
||||||
|
voice_client.pause()
|
||||||
|
await channel.send(f"⏸ Riproduzione messa in pausa.\n"
|
||||||
|
f"Riprendi con `!resume`.")
|
||||||
|
|
||||||
|
@command
|
||||||
|
@requires_connected_voice_client
|
||||||
|
async def cmd_resume(self, channel: discord.TextChannel, author: discord.Member, params: typing.List[str]):
|
||||||
|
for voice_client in self.voice_clients:
|
||||||
|
if voice_client.is_playing():
|
||||||
|
voice_client.resume()
|
||||||
|
await channel.send(f"⏯ Riproduzione ripresa.")
|
||||||
|
|
||||||
|
|
||||||
def process(users_connection=None):
|
def process(users_connection=None):
|
||||||
|
|
Loading…
Reference in a new issue