add delete original message after 10 sec

This commit is contained in:
2021-11-29 23:17:54 +01:00
parent 02b5419594
commit 59c5df71af

10
main.py
View File

@@ -15,13 +15,13 @@
#################### ####################
## Imports ## Imports
import asyncio import asyncio as aio
import json
import logging as log import logging as log
import json
import random import random
from discord.ext import commands from discord.ext import commands
from lib.keep_alive import keep_alive #from lib.keep_alive import keep_alive
## Vars ## Vars
### Load and set Bot Config ### Load and set Bot Config
@@ -57,7 +57,7 @@ async def say_hello(ctx):
print(ctx.message.content) print(ctx.message.content)
print(ctx.message) print(ctx.message)
print(ctx.author) print(ctx.author)
await asyncio.sleep(random.randint(1,5)) await aio.sleep(random.randint(1,5))
await ctx.message.remove_reaction('🤔', bot.user) await ctx.message.remove_reaction('🤔', bot.user)
if random.randint(1,100) < 10: if random.randint(1,100) < 10:
log.error('say_hello function was failed') log.error('say_hello function was failed')
@@ -65,6 +65,8 @@ async def say_hello(ctx):
else: else:
log.info('Run say_hello successfully') log.info('Run say_hello successfully')
await ctx.message.add_reaction('') await ctx.message.add_reaction('')
await aio.sleep(10)
await ctx.message.delete()
#keep_alive() #keep_alive()
bot.run(BOTDATA['token']) bot.run(BOTDATA['token'])