关于python:Client = discord.client()TypeError:’module’对象不可调用

Client = discord.client() TypeError: 'module' object is not callable

为什么我要用我的代码来获取TypeError: 'module' object is not callable

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time
Client = discord.Client()
client = commands.Bot(command_prefix ="?")
@client.event
async def on_ready():
    print("Bot is online and connected to Discord")
@client.event
async def on_message(message):
 if message.content =="cookie":
 await client.send_message(message.channel,":cookie:")
client.run("...")

完全错误:

Error: Client = discord.client() TypeError: 'module' object is not callable


1
Client = discord.Client()

完全拆下此管路。您没有在任何地方使用Clientdiscord.ext.commands.Botdiscord.Client的一个子类,因此您可以通过Bot访问所有Client属性。