小编Eng*_*eer的帖子

Discord.py 新超时命令错误:“AttributeError:'User'对象没有属性'timeout_for'”

大家好,2022 年新年快乐!

自从最近为不和谐添加了“超时”以来,我尝试按照一些教程制作超时命令,例如:

https://docs.pycord.dev/en/master/api.html?highlight=timeout#discord.Member.timeout

https://youtu.be/c5V4OaTNDtM

但由于我不知道的原因,我可能会收到以下错误:

Ignoring exception in command timeout2:
Traceback (most recent call last):
  File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "/home/runner/Russia-Bot/moderator.py", line 42, in timeout2
    await member.timeout_for(time)
AttributeError: 'Member' object has no attribute 'timeout_for'

The above exception was the direct cause of the following exception:
    Traceback (most recent call last):
      File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
        await ctx.command.invoke(ctx)
      File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
        await injected(*ctx.args, **ctx.kwargs)
      File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in …
Run Code Online (Sandbox Code Playgroud)

timeout discord.py pycord

2
推荐指数
1
解决办法
2430
查看次数

标签 统计

discord.py ×1

pycord ×1

timeout ×1