当我尝试运行我的不和谐机器人时,它告诉我一个模块错误

时间:2021-04-22 02:58:32

标签: python-3.x discord.py

    import discord 
from discord.ext import commands


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

@client.command(name='scp')
async def scp(context):
    mods_channel = client.get_channel(806352117442543616)
    
    scp = discord.embed(title="scp wiki", description="http://www.scpwiki.com/scp-series", color=0xCC0000)

    await context.message.channel.send(embed=scp)

@client.event
async def on_ready():
    #do stuff

    mods_channel = client.get_channel(806352117442543616)
    await mods_channel.send('i work! ')

@client.event
async def on_typing():
    mods_channel = client.get_channel(806352117442543616)
    await mods_channel.send('i wonder what you are going to say :thinking:')

@client.event
async def on_message(message):
    if message.content == 'hello Irantu' or message.content == 'hello irantu':
        mods_channel = client.get_channel(806352117442543616)
        await mods_channel.send('HI! :smile:')
#run client

每当我运行它时,它都会给我 TypeError: 'module' object is not callable。 这是我为 scp 主题的不和谐服务器制作的不和谐机器人 这一切都是通过使用 Python 3.9.4 的 Visual Studio Code 完成的。

1 个答案:

答案 0 :(得分:1)

您正在尝试调用 discord.ext.commands.bot,这是一个模块。您可能正在寻找discord.ext.commands.Bot

from discord.ext import commands

client = commands.Bot(command_prefix="%")