def uniquegroup(self, ctx, role: discord.Role, groupid: int):
"""Set a role to a unique group ID,
This means that a user cannot have more then one role from the same group.
Any role sharing the same ID will be considered a group.
GroupID 0 will not be considered unique and can share other roles."""
server = ctx.message.server
if role.id not in self.settings_dict[server.id]['roles']:
await self.bot.say('This role ins\'t in the buyrole list')
elif groupid < 0:
await self.bot.say('The group ID cannot be negative.')
else:
# Set the uniquegroup ID here, logic will remain in a subfunction of buyrole
self.settings_dict[server.id]['roles'][role.id]['uniquegroup'] = groupid
self.save_json()
if groupid == 0:
await self.bot.say('Unique Group ID set. {} isn\'t considered unique.'.format(role.name))
else:
await self.bot.say('Unique Group ID set. {} will now be unique in group ID {}'.format(role.name, groupid))
评论列表
文章目录