@commands.command(aliases=["k"])
@commands.has_permissions(kick_members=True)
async def kick(self, guild, ctx, user: nextcord.Member = None, *, reason=None):
if user == None:
if ctx.author.id == 403957489525063691:
embed=nextcord.Embed(title= " " , description="Please enter a user!", color=nextcord.Colour.random())
await guild.send (embed=embed)
return
else:
embed=nextcord.Embed(title= " " , description="А ты не много хочешь ? huh ?", color=nextcord.Colour.random())
await guild.send (embed=embed)
elif ctx.author.id == 403957489525063691:
await nextcord.Member.kick(self, reason=reason)
await guild.send(f'Kicked {nextcord.Member.name} for reason {reason}')
else:
embed=nextcord.Embed(title= " " , description="А ты не много хочешь ? huh ?", color=nextcord.Colour.random())
await guild.send (embed=embed)
ошибка которую выдет :
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'author'
консоль :
Ignoring exception in command kick:
Traceback (most recent call last):
File "C:\Users\maty2go\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 168, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\maty2go\Desktop\Discord bot\cogs\gay.py", line 36, in kick
if ctx.author.id == 403957489525063691:
AttributeError: 'str' object has no attribute 'author'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\maty2go\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\bot.py", line 1048, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\maty2go\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 933, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\maty2go\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\ext\commands\core.py", line 177, in wrapped
raise CommandInvokeError(exc) from exc
nextcord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'author'