猜谜游戏,discord.py 机器人
问题描述
我正在尝试制作一个不和谐的机器人猜谜游戏(使用 python),但它一直失败.我查看了许多类似的帖子,但没有发现任何帮助.
Im trying to make a discord bot guessing game (using python) but it keeps failing. I have looked at many similar posts and haven't found anything that helps.
** 通常它会说: , check=check,但这似乎不起作用,它说,检查未定义或类似的东西
** normaly it would say: , check=check, but that doesnt seem to work, it says, check not defined or something like that
代码似乎卡在:for i in range(0,5):
,或:guess = await client.wait_for('message')
有人可以帮忙吗?或者发布一个有效的猜谜游戏+解释?
could someone help?, or post a guessing game that works + explanation?
推荐答案
正如评论中提到的,你需要包含你自己的check
.如下所示:
As mentioned in the comments, you need to include your own check
. This looks like the following:
这确保只有来自命令作者的消息被识别和接受.我们将其包含在代码中.
This ensures that only the message from the author of the command is recognized and accepted. We include this in the code.
另外,你不能使用 </>number
,你会得到如下错误:
Also, you can't use </> number
, you will get the following error:
要解决这个问题,只需将 number
更改为 str:
To fix this, simply change number
to a str:
可能的代码是:
这篇关于猜谜游戏,discord.py 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!