Search code examples
pythondiscordbotsattributeerror

Discord Bot: Have a AttributeError with decorator command()


I'm a begginer in python,so I need your help. Now I'm trying to create a bot calculater, but I have the error that I did not understand and I've found nothing about it.

@client.command()
async def roll(ctx, arg=7):
   author = ctx.message.author
   runnum = random.randint(0,arg)
   await ctx.send(f"{author.mention}, ваш бросок равен ".format(runnum))   

enter image description here


Solution

  • Do not use discord.Client if you want to use commands.

    Use commands.Bot.

    https://discordpy.readthedocs.io/en/stable/ext/commands/commands.html#commands