From 02b5419594d484b537bcb12ef4ca2bd1d916fa34 Mon Sep 17 00:00:00 2001
From: anima
Date: Mon, 29 Nov 2021 19:56:36 +0100
Subject: [PATCH] add status emoji reation
---
main.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/main.py b/main.py
index 260d1d2..bac6325 100644
--- a/main.py
+++ b/main.py
@@ -15,8 +15,10 @@
####################
## Imports
+import asyncio
import json
import logging as log
+import random
from discord.ext import commands
from lib.keep_alive import keep_alive
@@ -48,12 +50,21 @@ async def on_ready():
### Commands
@bot.command(name='hello', help='Say hello!')
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}>!')
print(ctx.guild)
print(ctx.message.content)
print(ctx.message)
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()
bot.run(BOTDATA['token'])