add status emoji reation

This commit is contained in:
2021-11-29 19:56:36 +01:00
parent 3076c13908
commit 02b5419594

13
main.py
View File

@@ -15,8 +15,10 @@
#################### ####################
## Imports ## Imports
import asyncio
import json import json
import logging as log import logging as log
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
@@ -48,12 +50,21 @@ async def on_ready():
### Commands ### Commands
@bot.command(name='hello', help='Say hello!') @bot.command(name='hello', help='Say hello!')
async def say_hello(ctx): async def say_hello(ctx):
print(f'{ctx}') log.info('Start say_hello function')
await ctx.message.add_reaction('🤔')
await ctx.send(f'Hello, <@{ctx.author.id}>!') await ctx.send(f'Hello, <@{ctx.author.id}>!')
print(ctx.guild) print(ctx.guild)
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 ctx.message.remove_reaction('🤔', bot.user)
if random.randint(1,100) < 10:
log.error('say_hello function was failed')
await ctx.message.add_reaction('')
else:
log.info('Run say_hello successfully')
await ctx.message.add_reaction('')
#keep_alive() #keep_alive()
bot.run(BOTDATA['token']) bot.run(BOTDATA['token'])