[英]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.