【发布时间】:2022-01-07 12:35:07
【问题描述】:
我正在尝试执行“tempmute”命令之类的操作,但不断弹出错误 :
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NotFound: 404 Not Found (error code: 10011): Unknown Role
这是命令代码
@commands.command()
@commands.has_permissions(ban_members=True)
async def tempmute(self, ctx, member: discord.Member = None, * time):
if not member:
await ctx.send(embed=discord.Embed(title='Вы должны указать участника!', color=random.choice(colors)))
else:
LMUTED = discord.utils.get(ctx.message.guild.roles, name='LMUTED')
if not LMUTED:
perms=discord.Permissions(send_messages=False)
await ctx.guild.create_role(name='LMUTED',
colour=discord.Colour(0x0000FF),
permissions = perms)
await ctx.send(f'Я создал роль `{LMUTED}`!')
await member.add_roles(member, LMUTED)
await ctx.send(f'Я замьютил {member} на {time}!')
await s(time * 60)
await ctx.remove_roles(member, LMUTED)
【问题讨论】:
标签: python discord discord.py