import asyncio, redis
from threading import Thread, Timer
db = redis.StrictRedis(host='localhost', port=6379, db=0, charset='UTF-8', decode_responses=True)
txts = ['txt1','txt2','txt3']
async def Send_GP():
async for dialog in bot.iter_dialogs():
if dialog.is_group:
text = random.choice(txts)
await bot.send_message(dialog.id, text)
async def send_chat():
try:
t = asyncio.get_event_loop().create_task(send_chat)
await t()
db.setex('timeleft:',int(db.get('time_chat:')),True)
Timer(int(db.get('time_chat:')), t, []).start()
except Exception as e:
print(e)
Hello, what is the problem with the code ?
is my error :
coroutine 'send_chat' was never awaited self.function(*self.args, **self.kwargs)