1
0
Fork 0
mirror of https://gitlab.jonasled.de/jonasled/discordbot synced 2024-10-03 07:48:58 +02:00

added stop command for music bot

This commit is contained in:
Jonas Leder 2020-04-10 21:10:51 +02:00
parent 6967b44f0c
commit 3742d6ce44

16
bot.py
View file

@ -432,6 +432,21 @@ async def que(ctx):
await ctx.message.channel.send(message)#send the prepared message
@bot.command(brief="stop the music bot and clear the que")
async def stop(ctx):
global player#import the global variables
global playerQue
global titleQue
global downloadQue
if (playerServer != ctx.message.guild.id):#check if the music bot runns on this server
await ctx.message.channel.send("You can't stop the music bot on a different server.")
return
playerQue = []#delte all ques
titleQue = []
downloadQue = []
player.stop()#stop the current song
async def checkForNextSong():#background task, that runns every seccond and checks if the song ended
global player#import the global variables
@ -451,6 +466,7 @@ async def checkForNextSong():#background task, that runns every seccond and chec
await player.disconnect()
player = None
playerServer = None#allow everyone to invite the music bot
remove("*.mp3")#delete all mp3 files
else:
playing = True#set playing to true and play the next file
player.play(discord.FFmpegPCMAudio(playerQue[0]))