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

if user sends private a string with time, send the time

This commit is contained in:
Jonas Leder 2020-04-10 20:41:29 +02:00
parent f6e49e816b
commit 0ec2bd00db

10
bot.py
View file

@ -58,6 +58,11 @@ async def on_ready():
@bot.event
async def on_message(message):#this will run on every message
if (message.guild == None) and "time" in message.content:
current_time = datetime.now().strftime("%H:%M:%S")
await message.author.send("Current time: " + current_time)
return
print(str(message.author) + " sent: " + str(message.content) + ", latency: " + str(bot.latency) + " ms, Bot: " + str(message.author.bot)) #print some information about the message to the console
if(message.author.bot) or (message.author.id == bot.user.id): #check if the bot has written the message, if yes stop parsing it
return
@ -417,7 +422,7 @@ async def skip(ctx):
player.stop()
await ctx.message.channel.send("Skipped current song")
@bot.command(brief="Prints the current que")
@bot.command(brief="Prints the current music que")
async def que(ctx):
global titleQue
message = "**Musicbot Que:**\n **[current]** " + titleQue[0]
@ -427,8 +432,7 @@ async def que(ctx):
await ctx.message.channel.send(message)
async def checkForNextSong():
global player
global playerQue