1
0
Fork 0
mirror of synced 2024-06-27 02:31:04 +12:00

Changed up what permissions are required for role management

This commit is contained in:
Phxntxm 2016-08-28 15:00:34 -05:00
parent 402ddb061c
commit 0e785ef9b0
3 changed files with 10 additions and 8 deletions

View file

@ -128,7 +128,7 @@ class Mod:
if "is_owner" in func.__qualname__: if "is_owner" in func.__qualname__:
await self.bot.say("You need to own the bot to run this command") await self.bot.say("You need to own the bot to run this command")
return return
await self.bot.say("You are required to have `manage_server` permissions to run {}".format(cmd.qualified_name)) await self.bot.say("You are required to have `manage_server` permissions to run `{}`".format(cmd.qualified_name))
return return
# Perms will be an attribute if custom_perms is found no matter what, so need to check this # Perms will be an attribute if custom_perms is found no matter what, so need to check this

View file

@ -13,7 +13,7 @@ class Roles:
self.bot = bot self.bot = bot
@commands.group(aliases=['roles'], invoke_without_command=True, no_pm=True, pass_context=True) @commands.group(aliases=['roles'], invoke_without_command=True, no_pm=True, pass_context=True)
@checks.custom_perms(manage_server=True) @checks.custom_perms(send_messages=True)
async def role(self, ctx): async def role(self, ctx):
"""This command can be used to modify the roles on the server. """This command can be used to modify the roles on the server.
Pass no subcommands and this will print the roles currently available on this server""" Pass no subcommands and this will print the roles currently available on this server"""
@ -22,7 +22,7 @@ class Roles:
await self.bot.say("Your server's roles are: ```\n{}```".format("\n".join(server_roles))) await self.bot.say("Your server's roles are: ```\n{}```".format("\n".join(server_roles)))
@role.command(name='remove', pass_context=True, no_pm=True) @role.command(name='remove', pass_context=True, no_pm=True)
@checks.custom_perms(manage_server=True) @checks.custom_perms(manage_roles=True)
async def remove_role(self, ctx): async def remove_role(self, ctx):
"""Use this to remove roles from a number of members""" """Use this to remove roles from a number of members"""
# No use in running through everything if the bot cannot manage roles # No use in running through everything if the bot cannot manage roles
@ -77,7 +77,7 @@ class Roles:
"```\n{}```".format("\n".join(role_names), "\n".join([m.display_name for m in members]))) "```\n{}```".format("\n".join(role_names), "\n".join([m.display_name for m in members])))
@role.command(name='add', pass_context=True, no_pm=True) @role.command(name='add', pass_context=True, no_pm=True)
@checks.custom_perms(manage_server=True) @checks.custom_perms(manage_roles=True)
async def add_role(self, ctx): async def add_role(self, ctx):
"""Use this to add a role to multiple members. """Use this to add a role to multiple members.
Provide the list of members, and I'll ask for the role Provide the list of members, and I'll ask for the role
@ -127,7 +127,7 @@ class Roles:
"```\n{}```".format("\n".join(role_names), "\n".join([m.display_name for m in members]))) "```\n{}```".format("\n".join(role_names), "\n".join([m.display_name for m in members])))
@role.command(name='delete', pass_context=True, no_pm=True) @role.command(name='delete', pass_context=True, no_pm=True)
@checks.custom_perms(manage_server=True) @checks.custom_perms(manage_roles=True)
async def delete_role(self, ctx, *, role: discord.Role = None): async def delete_role(self, ctx, *, role: discord.Role = None):
"""This command can be used to delete one of the roles from the server""" """This command can be used to delete one of the roles from the server"""
# No use in running through everything if the bot cannot manage roles # No use in running through everything if the bot cannot manage roles
@ -159,7 +159,7 @@ class Roles:
await self.bot.say("I have just removed the role {} from this server".format(role.name)) await self.bot.say("I have just removed the role {} from this server".format(role.name))
@role.command(name='create', pass_context=True, no_pm=True) @role.command(name='create', pass_context=True, no_pm=True)
@checks.custom_perms(manage_server=True) @checks.custom_perms(manage_roles=True)
async def create_role(self, ctx): async def create_role(self, ctx):
"""This command can be used to create a new role for this server """This command can be used to create a new role for this server
A prompt will follow asking what settings you would like for this new role A prompt will follow asking what settings you would like for this new role

View file

@ -239,6 +239,8 @@ class TicTacToe:
# If no one has won, and the game has not ended in a tie, print the new updated board # If no one has won, and the game has not ended in a tie, print the new updated board
# TODO: edit in place instead of printing? # TODO: edit in place instead of printing?
else: else:
player_turn = board.challengers.get('x') if board.X_turn else board.challengers.get('o')
fmt = str(board) + "\nIt is now your turn "
await self.bot.say(str(board)) await self.bot.say(str(board))
@tictactoe.command(name='start', aliases=['challenge', 'create'], pass_context=True, no_pm=True) @tictactoe.command(name='start', aliases=['challenge', 'create'], pass_context=True, no_pm=True)
@ -261,8 +263,8 @@ class TicTacToe:
# Print the board too just because # Print the board too just because
fmt += str(self.boards[ctx.message.server.id]) fmt += str(self.boards[ctx.message.server.id])
# We don't need to do anything weird with assigning x_player to something, it is already a member object, just use it # We don't need to do anything weird with assigning x_player to something, it is already a member object, just use it
fmt += "I have decided at random, and {} is going to be x's this game. It is your turn first!".format( fmt += "I have decided at random, and {} is going to be x's this game. It is your turn first!\n"
x_player.display_name) "Use the {}tictactoe command, and a position, to choose where you want to play".format(x_player.display_name, ctx.prefix)
await self.bot.say(fmt) await self.bot.say(fmt)
@tictactoe.command(name='delete', aliases=['stop', 'remove', 'end'], pass_context=True, no_pm=True) @tictactoe.command(name='delete', aliases=['stop', 'remove', 'end'], pass_context=True, no_pm=True)