【问题标题】:TypeError: 'module' object is not callable on discord pyTypeError:“模块”对象在不和谐 py 上不可调用
【发布时间】:2022-01-03 20:37:23
【问题描述】:
from discord.ext import commands

token = 'token goess here'

client = commands.bot(command_prefix = '__')

@client.event
async def on_ready():
    print('Bot is ready')

client.run(token)

代码之前运行良好,现在我收到“TypeError: 'module' is not callable”错误 我找不到我的代码有什么问题,所以......知道出了什么问题吗? 谢谢

【问题讨论】:

    标签: python python-3.x discord.py


    【解决方案1】:

    改变

    client = commands.bot(command_prefix = '__')
    

    到

    client = commands.Bot(command_prefix = '__')
    

    discord.ext.commands 包含 bot.py 模块,这会导致您遇到错误,您正在寻找该模块公开的 Bot 类。

    【讨论】:

    • 感谢您的回答,现在可以使用了。但我仍然想知道为什么代码在我第一次运行时就可以工作......
    猜你喜欢
    • 2021-12-24
    • 2017-06-17
    • 2014-09-21
    • 2011-05-30
    • 2021-11-22
    • 1970-01-01
    相关资源
    最近更新 更多