事前知識無し初心者ですごめんなさい
pythonでDiscordBotを作ってるのですが、時報がうまく動作せず以下のようなエラーが出てきます。
関数の設定?がうまくできてないようでどうすれば正常動作できますでしょうか?
Error
1Traceback (most recent call last): 2 File "/home/ubuntu/xxxx/xxxx.py", line 27, in <module> 3 async def timeloop(): 4 File "/home/ubuntu/.local/lib/python3.8/site-packages/discord/client.py", line 1015, in event 5 raise TypeError('event registered must be a coroutine function') 6TypeError: event registered must be a coroutine function
環境
- OracleCloud Ubuntu
- python 3.8.10
- discord.py 1.7.3
python
1import discord 2from discord.ext import tasks 3from datetime import datetime 4 5client = discord.Client(intents=discord.Intents.all()) 6 7@client.event 8@tasks.timeloop(seconds=60) 9async def loop(): 10 now = datetime.now().strftime('%H:%M') #現在時刻 UTC 9時間戻し 11 CHID = client.get_channel(XXXXXXXXXXXXXXX) 12 if now == '00:57': 13 z = "10時前だよ!" 14 await CHID.send(z) 15 16timeloop.start() 17client.run("xxxxxx") 18 19
あなたの回答
tips
プレビュー