D
D
danys_kun2020-08-27 20:53:33
Python
danys_kun, 2020-08-27 20:53:33

Why is the discord.py command not working?

The error itself:

Ignoring exception in command __dange:
Traceback (most recent call last):
  File "C:\Users\andro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\andro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 847, in invoke
    await self.prepare(ctx)
  File "C:\Users\andro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 784, in prepare
    await self._parse_arguments(ctx)
  File "C:\Users\andro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 690, in _parse_arguments
    transformed = await self.transform(ctx, param)
  File "C:\Users\andro\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ext\commands\core.py", line 535, in transform
    raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: message is a required argument that is missing.


Without this code here, everything works fine. But it is needed (maybe I'm implementing it incorrectly?)
@client.command(aliases = ['dange', 'dan'])
async def __dange(ctx, message):
  for row in cursor.execute(f"SELECT exp,lvl,cash,hp,maxattack,minattack FROM users WHERE id={message.author.id}"):
    if row[1] > 0:
      namedungeon = 'Dead city dungeon'
      unitsel = random.randint(1, 100)
      def unitselect():
        global unit, unithp, unitmaxattack, unitminattack
        if unitsel in range(76, 100) and hp > 0:
          unit = 'Skeleton Cowboy'
          unithp = 160
          unitmaxattack = 55
          unitminattack = 45
        elif unitsel in range(1, 75) and hp > 0:
          unit = 'Skeleton Cowboy'
          unithp = 160
          unitmaxattack = 55
          unitminattack = 45
      unitselect()
      userhp = row[3]
      userminattack = row[5]
      usermaxattack = row[4]
      flag = True
      while flag:
        if userhp > 0:
          userattack = random.randint(userminattack, usermaxattack)
          unitattack = random.randint(unitminattack, unitmaxattack)
          userhp = userhp - unitattack
          unithp = unithp - userattack
          if userhp > 0 and unithp < 0:
            embed = discord.Embed(title='Информация о бое', color=discord.Color.blue())
            embed.add_field(name='Вы победили', value='кек', inline=False)
            flag = False
          elif userhp < 0 and unithp > 0:
            embed = discord.Embed(title='Информация о бое', color=discord.Color.blue())
            embed.add_field(name='Вы проиграли', value='кек', inline=False)
              flag = False
          elif userhp < 0 and unithp < 0:
            embed = discord.Embed(title='Информация о бое', color=discord.Color.blue())
            embed.add_field(name='Ничья', value='ы', inline=False)
            flag = False
          elif userhp > 0 and unithp > 0:
            flag = True
    else:
      await ctx.send('Извени, но у тебя слишком маленький уровень(')

Answer the question

In order to leave comments, you need to log in

2 answer(s)
U
UberPool, 2020-08-27
@UberPool

your error says discord.ext.commands.errors.MissingRequiredArgument: message is a required argument that is missing.

M
Maxim Nevzorov, 2020-08-28
@fixator10

Discord py not working help why?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question