[英]How to get a new input in discord.py
這是我的代碼片段。 如果用戶在不和諧中發送消息“??.”,我想打破循環。 我知道問題在於它沒有接受新的輸入並基於第一次發送的命令我不知道如何在 discord.py 中修復它。 任何建議,將不勝感激。
for i in range(1000):
await message.channel.send(message.content.replace("!spam",""))
if client.wait_for("message") == "??":
print("stopped")
break
else:
continue
client.wait_for
方法是一個協程,所以你需要await
它。 它還返回一個discord.Message
實例,而不是一個字符串。
for i in range(1000):
await message.channel.send(message.content.replace("!spam", ""))
msg = await client.wait_for("message")
if msg.content == "??":
break
你可能想在wait_for
方法中添加一個check
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.