Hey, I want to create an argument in a slashcommand that takes a certain form. I've found out about converters, but I can't seem to find how to reject an input
(e.g. if you have a Member option, and you type something that's not a valid member, discord says "Not a valid user.". I'd like something like that)
What I currently tried:
class MoneyConverter(Converter[int]):
async def convert(self, ctx, argument: str) -> int:
amount = -1
try:
if(argument[-1] == "k"):
amount = int(argument[:-1])
elif(argument[-1] == "m"):
amount = round(1000*float(argument[:-1]))
else:
amount = int(argument)
except:
raise BadArgument(argument)
if round(amount,-2) != amount:
raise BadArgument(argument)
return amount
However, raising an exception doesn't give the result I wanted