前提・実現したいこと
discord.pyでメッセージを送信する関数を作りたいのですが、エラーが発生してしまいます。
発生している問題・エラーメッセージ
C:\Users***\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\client.py:350: RuntimeWarning: coroutine 'test' was never awaited pass RuntimeWarning: Enable tracemalloc to get the object allocation traceback
該当のソースコード
def
1async def test(chid): 2 await client.get_channel(chid).send("ok")
if
1async def on_message(message): 2 mentions = message.mentions 3 if message.author.bot: 4 return 5 if message.content == "!test": 6 chid = message.channel.id 7 loop = asyncio.get_event_loop() 8 loop.run_until_complete(test(chid))
あなたの回答
tips
プレビュー