1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Aggiunto !skip

This commit is contained in:
Steffo 2018-05-29 21:55:05 +02:00
parent 87e492127d
commit 23e0debaef

View file

@ -308,6 +308,10 @@ async def on_message(message: discord.Message):
await cmd_play(channel=message.channel, await cmd_play(channel=message.channel,
author=message.author, author=message.author,
params=message.content.split(" ")) params=message.content.split(" "))
elif message.content.startswith("!skip"):
await cmd_skip(channel=message.channel,
author=message.author,
params=message.content.split(" "))
elif message.content.startswith("!remove"): elif message.content.startswith("!remove"):
await cmd_remove(channel=message.channel, await cmd_remove(channel=message.channel,
author=message.author, author=message.author,
@ -341,7 +345,7 @@ async def update_users_pipe(users_connection):
discord_members = list(client.get_server(config["Discord"]["server_id"]).members) discord_members = list(client.get_server(config["Discord"]["server_id"]).members)
users_connection.send(discord_members) users_connection.send(discord_members)
if msg == "/uranium": if msg == "/uranium":
add_video_from_url("https://www.youtube.com/watch?v=iutuQbMAx04") await add_video_from_url("https://www.youtube.com/watch?v=iutuQbMAx04")
def command(func): def command(func):
@ -479,6 +483,9 @@ async def cmd_play(channel: discord.Channel, author: discord.Member, params: typ
@requires_cv @requires_cv
async def cmd_skip(channel: discord.Channel, author: discord.Member, params: typing.List[str]): async def cmd_skip(channel: discord.Channel, author: discord.Member, params: typing.List[str]):
global voice_player global voice_player
if voice_player is None:
await client.send_message(channel, "⚠ Non c'è nessun video in riproduzione.")
return
voice_player.stop() voice_player.stop()
await client.send_message(channel, f"⏩ Video saltato.") await client.send_message(channel, f"⏩ Video saltato.")
@ -565,7 +572,6 @@ async def queue_play_next_video():
await asyncio.sleep(0.5) await asyncio.sleep(0.5)
continue continue
if len(voice_queue) == 0: if len(voice_queue) == 0:
await client.change_presence()
await asyncio.sleep(0.5) await asyncio.sleep(0.5)
continue continue
next_video = voice_queue[0] next_video = voice_queue[0]