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