【发布时间】:2021-02-18 05:55:41
【问题描述】:
我已经搜索了很多,但在堆栈上找不到此案例的解决方案。
我想使用 1 个命令从角色中删除所有用户。
@client.command()
async def swipe(ctx, role: discord.Role):
if ctx.author.guild_permissions.administrator:
roles = tuple(get(ctx.guild.roles, name=n) for n in role)
for m in ctx.guild.members:
try:
await member.remove_roles(*roles)
except:
print(f"Couldn't remove roles from {m}")
await ctx.send(f'Removed **all** experimental roles.')
我收到以下错误:
File "C:\Users\Admin\Desktop\epic guard\bot.py", line 37, in swipe
roles = tuple(get(ctx.guild.roles, name=n) for n in role)
TypeError: 'Role' object is not iterable
【问题讨论】:
标签: python discord discord.py