簡體   English   中英

類型錯誤:“模塊”對象不可調用。 當我運行它時它不起作用,因為第 4 行出現某種錯誤。我該怎么辦?

[英]TypeError: 'module' object is not callable. When I run it it does not work cuz there is some sort of error in line 4.What should I do?

import discord
from discord.ext import commands

bot = commands.bot(command_prefix='#')

@bot.command()
async def add(ctx, num1:int, num2:int):
  await ctx.reply(num1+num2)

@bot.command()
async def subtract(ctx, num1:int, num2:int):
  await ctx.reply(num1-num2)

@bot.command()
async def multiply(ctx, num1:int, num2:int):
  await ctx.reply(num1*num2)

@bot.command()
async def divide(ctx, num1:int, num2:int):
  await ctx.reply(num1/num2)

@bot.command()
async def square(ctx, num1:int, num2:int):
  await ctx.reply(num1**num2)

bot.run('TOKEN')

嘗試做bot = commands.Bot(command_prefix = '#')而不是bot = commands.bot(command_prefix='#')

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM