Here you have the code I made for the command :
#?dodaj
@client.command()
async def dodaj(ctx, a: int, b: int):
if (a == int and b == int):
await ctx.send(a + b)
else:
await ctx.send("Błąd : Nie mogłem obliczyc tego działania!")
I want to know what's wrong with this, because it won't work properly.
Here's the error i'm getting by typing "?dodaj coś jeszcze" :
Ignoring exception in command dodaj:
Traceback (most recent call last):
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 370, in _actual_conversion
return converter(argument)
ValueError: invalid literal for int() with base 10: 'coś'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\bot.py", line 863, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 721, in invoke
await self.prepare(ctx)
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 685, in prepare
await self._parse_arguments(ctx)
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 599, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 455, in transform
return await self.do_conversion(ctx, converter, argument, param)
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 408, in do_conversion
return await self._actual_conversion(ctx, converter, argument, param)
File "C:\Users\PC\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\ext\commands\core.py", line 379, in _actual_conversion
raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "int" failed for parameter "a".
Also when I type "?dodaj 20 20" it should add the 20's but it sends the error message that can be seen in the else parameter, in the code.