![](/img/trans.png)
[英]Get permissions with @client.event on_message (Discord.py)
[英]How to send message without @client.event in discord.py?
我需要一種方法來不斷檢查 discord.py 中的消息'kill'
。我的代碼中有很多 while 循環,所以我需要使用線程模塊創建一個新線程。 如何在沒有事件的情況下將消息發送到具有該線程的通道。
您可以使用asyncio.get_event_loop().create_task(channel.send("example message"))
。 像這樣使用它:
import asyncio
client = discord.Client()
def funct():
channel = client.get_channel(channel_id)
asyncio.get_event_loop().create_task(channel.send("example message"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.