[英]How to get a new input in discord.py
This is a snippet of my code.这是我的代码片段。 I want to break the loop if a user messages on discord "??."
如果用户在不和谐中发送消息“??.”,我想打破循环。 I know the problem is that its not taking a new input and basing the command of the first send I dont know how to fix it in discord.py however.
我知道问题在于它没有接受新的输入并基于第一次发送的命令我不知道如何在 discord.py 中修复它。 Any suggestions would be appreciated.
任何建议,将不胜感激。
for i in range(1000):
await message.channel.send(message.content.replace("!spam",""))
if client.wait_for("message") == "??":
print("stopped")
break
else:
continue
The client.wait_for
method is a coroutine so you need to await
it. client.wait_for
方法是一个协程,所以你需要await
它。 It also returns a discord.Message
instance, not a string.它还返回一个
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
You might wanna add a check
to the wait_for
method你可能想在
wait_for
方法中添加一个check
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.