首页 > 解决方案 > Discord.py bot - TypeError:“模块”对象不可调用

问题描述

刚开始制作机器人,正在测试它是否会上线。

命令:

C:\Users\Allied Gaming\hello> & D:/Games/python.exe "c:/Users/Allied Gaming/hello/bot.py" 

错误:

Traceback (most recent call last):
  File "c:\Users\Allied Gaming\hello\bot.py", line 2, in <module>
    client = discord.client()
TypeError: 'module' object is not callable
PS C:\Users\Allied Gaming\hello> 

这是代码:

import discord
client = discord.client()

这就是我目前拥有的所有代码,除了我的令牌。

标签: pythondiscord.py

解决方案


尝试这个:

client = discord.Client()

从文档中,客户端应该大写。

https://discordpy.readthedocs.io/en/latest/


推荐阅读