-
Hello! I have a problem with changing the user's nickname. I did everything according to the documentation, but an error appears. @bot.command()
async def nick(ctx, nick=None):
if not nick:
await ctx.message.add_reaction("❌")
await ctx.send("...")
elif check_nickname(nick):
await ctx.message.add_reaction("❌")
await ctx.send("...")
else:
await ctx.message.add_reaction("✅")
await ctx.author.edit(nick=nick) #Error Error: Ignoring exception in command nick:
Traceback (most recent call last):
File "discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "X.py", line 52, in nick
await ctx.author.edit(nick=nick)
File "discord/member.py", line 572, in edit
guild_id = self.guild.id
AttributeError: 'NoneType' object has no attribute 'id'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "discord/ext/commands/bot.py", line 935, in invoke
await ctx.command.invoke(ctx)
File "discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'``` |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
It's impossible for the library to give |
Beta Was this translation helpful? Give feedback.
-
What is the code for |
Beta Was this translation helpful? Give feedback.
-
Thanks for @AbstractUmbra |
Beta Was this translation helpful? Give feedback.
It's impossible for the library to give
Member.guild
aNone
value. Are you by any chance assigningmember.guild = ...
somewhere in the code?