问题描述
我已经制作了一个临时代码,或者我们可以说我在 stackoverflow 上找到了一个.我复制了代码,但它似乎不起作用.如果你们中的任何人现在可以帮助我,谢谢!代码是;
I have made a tempmute code or we can say I found one on stackoverflow. I copied the code but it doesn't seem to work. If anyone of you now and can help me thanks! The code is;
我得到的错误如下;
推荐答案
这是因为 Command
有 Converter
s 在其参数上运行.由于 time
默认为 0
,其类型为 int
,因此库尝试将 time
转换为 >int
.但是,如果您提供像 10m
这样的单位后缀,则此转换将失败,因为 int('10m')
失败并出现 ValueError
,其中轮到提出 BadArgument
.
This is because Command
s have Converter
s that are run on their arguments. Since time
defaults to 0
, which is of type int
, the library tries to convert time
to an int
. However, this conversion will fail if you give a unit suffix like 10m
, since int('10m')
fails with a ValueError
, which in turn raises BadArgument
.
要解决这个问题,只需在 time
参数中添加适当的类型注释:
To fix this, simply add a proper type annotation to your time
parameter:
这篇关于我的 TEMPMUTE 命令出现一定错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!