When I pass *grant @user add
in Discord I get the following exception:
Ignoring exception in command grant:
Traceback (most recent call last):File "/Users/test/PycharmProjects/slapdash/venv/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 902, in invokeawait ctx.command.invoke(ctx)File "/Users/test/PycharmProjects/slapdash/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 856, in invokeawait self.prepare(ctx)File "/Users/test/PycharmProjects/slapdash/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 790, in prepareawait self._parse_arguments(ctx)File "/Users/test/PycharmProjects/slapdash/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 706, in _parse_argumentskwargs[name] = await self.transform(ctx, param)File "/Users/test/PycharmProjects/slapdash/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 552, in transformreturn await self.do_conversion(ctx, converter, argument, param)File "/Users/test/PycharmProjects/slapdash/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 505, in do_conversionreturn await self._actual_conversion(ctx, converter, argument, param)File "/Users/test/PycharmProjects/slapdash/venv/lib/python3.8/site-packages/discord/ext/commands/core.py", line 451, in _actual_conversionret = await instance.convert(ctx, argument)File "/Users/test/PycharmProjects/slapdash/venv/lib/python3.8/site-packages/discord/ext/commands/converter.py", line 191, in convertraise MemberNotFound(argument)
discord.ext.commands.errors.MemberNotFound: Member "<@!id> add" not found.
@user
is a mention of myself in Discord and it's being recognized by Discord, tho not by my bot when converting to a Member.
grant
function's code (tho it's a private room perms system):
@bot.command()
async def grant(ctx, *, member: discord.Member = None, command=None):if (member is not None and # if member argument providedcommand is not None and # if command argument providedctx.channel.category_id in instances and # if in dictionarymember.id != instances[ctx.channel.category_id]['admin_id'] and # if not admincommand in ['add', 'remove', 'exit', 'grant', 'deny'] and(ctx.author.id == instances[ctx.channel.category_id]['admin_id'] or # if adminctx.author.id in instances[ctx.channel.category_id]['granted']['grant_id_list'] # if granted)):if command == 'add' and member.id not in instances[ctx.channel.category_id]['granted']['add_id_list']:instances[ctx.channel.category_id]['granted']['add_id_list'].append(member.id)await ctx.send(f"Successfully granted to {member.mention}, but you'd better grant `remove` as well!")elif (member is not None and # if member argument providedcommand is None and # if command argument not providedctx.channel.category_id in instances and # if in dictionarymember.id != instances[ctx.channel.category_id]['admin_id'] and # if not admin(ctx.author.id == instances[ctx.channel.category_id]['admin_id'] or # if adminctx.author.id in instances[ctx.channel.category_id]['granted']['grant_id_list'] # if granted)):if member.id not in instances[ctx.channel.category_id]['granted']['add_id_list']: # if not addinstances[ctx.channel.category_id]['granted']['add_id_list'].append(member.id)if member.id not in instances[ctx.channel.category_id]['granted']['remove_id_list']: # if not removeinstances[ctx.channel.category_id]['granted']['remove_id_list'].append(member.id)await ctx.send(f"Successfully granted `add` and `remove` to {member.mention}!")else:await ctx.send('Use `*help` to learn commands 😝')