M
M
Maruf2021-08-22 04:15:42
Python
Maruf, 2021-08-22 04:15:42

What to do with the code?

I am writing a bot for discord, I wrote the mute command, but it does not issue it. gives some error. although everything was fine before,
here is the code

@client.command(pass_context=True)
async def help(ctx):   (это 94 строчка кода)
    await  ctx.channel.purge(limit=1)
    emb = discord.Embed(title='Все Команды')

    emb.add_field(name='{}clear'.format(PREFIX), value='Очиска чата')
    emb.add_field(name='{}kick'.format(PREFIX), value='Удаление участника с сервера')
    emb.add_field(name='{}ban'.format(PREFIX), value='Бан участника')
    emb.add_field(name='{}unban'.format(PREFIX), value='Разбанить учатника')
    emb.add_field(name='{}time'.format(PREFIX), value='Время (Москва) ')
    emb.add_field(name='{}mute'.format(PREFIX), value='Мут участнику ')
    emb.add_field(name='{}unmute'.format(PREFIX), value='Убрать мут участнику ')

    await  ctx.send(embed=emb)

here is the error
File "C:\Users\user\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
    raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'mesagge'

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
inFureal, 2021-08-22
@inFureal

Well written. The mesagge attribute is missing in core.py on the Context object.
Most likely a typo. I assume that there should be a message

N
Nikita Mokhovikov, 2021-08-31
@mohovoy

Look, this code works for me. There may be an error in the definition of the function, that is, instead of this:

@client.command(pass_context=True)
async def help(ctx):   (это 94 строчка кода)

I wrote like this:
@client.command()
async def help(ctx):

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question