【发布时间】:2018-05-04 18:00:24
【问题描述】:
[续。我最近的两个帖子]
在升级 aiohttp 并使用“main”修复导入问题后,我在尝试从 Discord 机器人运行命令时遇到了另一个错误。有没有什么办法解决这一问题?
Ignoring exception in command botcheck
Traceback (most recent call last):
File "C:\Users\Jeriel\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\discord\ext\commands\core.py", line 50, in wrapped
ret = yield from coro(*args, **kwargs)
File "C:\Users\Jeriel\Desktop\JerryBot\run.py", line 15, in botcheck
await bot.say("I am up and running! {}".format(ctx.message.author.mention())
)
TypeError: 'str' object is not callable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Jeriel\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\discord\ext\commands\bot.py", line 846, in process_commands
yield from command.invoke(ctx)
File "C:\Users\Jeriel\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\discord\ext\commands\core.py", line 374, in invoke
yield from injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Jeriel\AppData\Local\Programs\Python\Python36-32\lib\site-packa
ges\discord\ext\commands\core.py", line 54, in wrapped
raise CommandInvokeError(e) from e
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: Typ
eError: 'str' object is not callable
【问题讨论】:
-
ctx.message.author.mention是什么类型的对象? -
请添加一个minimal reproducible example的run.py代码
-
有错别字的问题通常会被关闭或删除。顺便说一句
标签: python python-3.x discord.py