Код: Выделить всё
Traceback (most recent call last):
File "bot.py", line 55, in
send_cal.start()
File "python3.8/site-packages/discord/ext/tasks/__init__.py", line 398, in start
self._task = asyncio.create_task(self._loop(*args, **kwargs))
File "/usr/local/Cellar/python@3.8/3.8.16/Frameworks/Python.framework/Versions/3.8/lib/python3.8/asyncio/tasks.py", line 381, in create_task
loop = events.get_running_loop()
RuntimeError: no running event loop
sys:1: RuntimeWarning: coroutine 'Loop._loop' was never awaited
Код: Выделить всё
@tasks.loop(seconds=20.0)
async def send_cal():
message_channel = bot.get_channel(target_channel_id)
print(f"Got channel {message_channel}")
df = await someApi()
df = df.drop(['stuff'], axis=1)
csv = df.to_csv(header=False, index=False)
res = csv.replace(',', ' ----> ')
if (len(res)) >= 2000:
await message.channel.send('result over 2000 chars')
await message.channel.send(res)
@send_cal.before_loop
async def before():
await client.wait_until_ready()
print("Finished waiting")
send_cal.start()
client.run('mytoken')
редактировать: на самом деле я просто копирую руководство для начинающих здесь https://discordpy.readthedocs.io/en/lat ... index.html
Подробнее: https://stackoverflow.com/questions/763 ... er-awaited
Мобильная версия