def fixroles(self, ctx):
"""Adds the role members were supposed to get when they joined but didn't."""
counter = 0
role = discord.utils.get(ctx.message.server.roles, id=self.settings[ctx.message.server.id]['role'])
if role == None:
await self.bot.say("The role set doesn't exist anymore.")
return
status = await self.bot.say("Adding roles...")
for m in ctx.message.server.members:
if [r.name for r in m.roles] == ["@everyone"]:
try:
await self.bot.add_roles(m, role)
counter += 1
except discord.Forbidden:
await self.bot.say("I am not allowed to add roles.")
return
await self.bot.edit_message(status, "Added the **{}** role to **{}** members.".format(role.name, str(counter)))
评论列表
文章目录