def setkillrole(self, ctx, role : discord.Role = None):
"""Sets the required role ID to add/remove hacks (admin only)."""
channel = ctx.message.channel
author = ctx.message.author
server = ctx.message.server
# Check if we're suppressing @here and @everyone mentions
if self.settings.getServerStat(ctx.message.server, "SuppressMentions").lower() == "yes":
suppress = True
else:
suppress = False
isAdmin = author.permissions_in(channel).administrator
# Only allow admins to change server stats
if not isAdmin:
await self.bot.send_message(channel, 'You do not have sufficient privileges to access this command.')
return
if role == None:
self.settings.setServerStat(server, "RequiredKillRole", "")
msg = 'Kill/resurrect now *admin-only*.'
await self.bot.send_message(channel, msg)
return
if type(role) is str:
try:
role = discord.utils.get(server.roles, name=role)
except:
print("That role does not exist")
return
# If we made it this far - then we can add it
self.settings.setServerStat(server, "RequiredKillRole", role.id)
msg = 'Role required for kill/resurrect set to **{}**.'.format(role.name)
# Check for suppress
if suppress:
msg = Nullify.clean(msg)
await self.bot.send_message(channel, msg)
评论列表
文章目录