Changes made for pep8
This commit is contained in:
parent
20f6c2bcc3
commit
f8b767eb1c
1 changed files with 14 additions and 13 deletions
19
cogs/mod.py
19
cogs/mod.py
|
@ -4,7 +4,7 @@ from .utils import config
|
||||||
import discord
|
import discord
|
||||||
import re
|
import re
|
||||||
|
|
||||||
valid_perms = [p for p in dir(discord.Permissions) if isinstance(getattr(discord.Permissions,p),property)]
|
valid_perms = [p for p in dir(discord.Permissions) if isinstance(getattr(discord.Permissions, p), property)]
|
||||||
|
|
||||||
|
|
||||||
class Mod:
|
class Mod:
|
||||||
|
@ -25,14 +25,14 @@ class Mod:
|
||||||
|
|
||||||
@commands.command(pass_context=True, no_pm=True)
|
@commands.command(pass_context=True, no_pm=True)
|
||||||
@checks.customPermsOrRole(kick_members=True)
|
@checks.customPermsOrRole(kick_members=True)
|
||||||
async def usernotify(self, ctx, on_off:str):
|
async def usernotify(self, ctx, on_off: str):
|
||||||
"""This command can be used to set whether or not you want user notificaitons to show
|
"""This command can be used to set whether or not you want user notificaitons to show
|
||||||
This will save what channel you run this command in, that will be the channel used to send the notification to
|
This will save what channel you run this command in, that will be the channel used to send the notification to
|
||||||
Provide on, yes, or true to set it on; otherwise it will be turned off"""
|
Provide on, yes, or true to set it on; otherwise it will be turned off"""
|
||||||
on_off = ctx.message.channel.id if re.search("(on|yes|true)",on_off.lower()) else None
|
on_off = ctx.message.channel.id if re.search("(on|yes|true)", on_off.lower()) else None
|
||||||
notifications = config.getContent('user_notifications') or {}
|
notifications = config.getContent('user_notifications') or {}
|
||||||
notifications[ctx.message.server.id] = on_off
|
notifications[ctx.message.server.id] = on_off
|
||||||
config.saveContent('user_notifications',notifications)
|
config.saveContent('user_notifications', notifications)
|
||||||
fmt = "notify" if on_off else "not notify"
|
fmt = "notify" if on_off else "not notify"
|
||||||
await self.bot.say("This server will now {} if someone has joined or left".format(fmt))
|
await self.bot.say("This server will now {} if someone has joined or left".format(fmt))
|
||||||
|
|
||||||
|
@ -75,11 +75,12 @@ class Mod:
|
||||||
|
|
||||||
@commands.group(pass_context=True, invoke_without_command=True, no_pm=True)
|
@commands.group(pass_context=True, invoke_without_command=True, no_pm=True)
|
||||||
@checks.customPermsOrRole(send_messages=True)
|
@checks.customPermsOrRole(send_messages=True)
|
||||||
async def perms(self, ctx, *, command: str=None):
|
async def perms(self, ctx, *, command: str = None):
|
||||||
"""This command can be used to print the current allowed permissions on a specific command
|
"""This command can be used to print the current allowed permissions on a specific command
|
||||||
This supports groups as well as subcommands; pass no argument to print a list of available permissions"""
|
This supports groups as well as subcommands; pass no argument to print a list of available permissions"""
|
||||||
if command is None:
|
if command is None:
|
||||||
await self.bot.say("Valid permissions are: ```\n{}```".format("\n".join("{}".format(i) for i in valid_perms)))
|
await self.bot.say(
|
||||||
|
"Valid permissions are: ```\n{}```".format("\n".join("{}".format(i) for i in valid_perms)))
|
||||||
return
|
return
|
||||||
|
|
||||||
custom_perms = config.getContent('custom_permissions') or {}
|
custom_perms = config.getContent('custom_permissions') or {}
|
||||||
|
@ -169,9 +170,9 @@ class Mod:
|
||||||
|
|
||||||
@commands.command(pass_context=True, no_pm=True)
|
@commands.command(pass_context=True, no_pm=True)
|
||||||
@checks.customPermsOrRole(manage_messages=True)
|
@checks.customPermsOrRole(manage_messages=True)
|
||||||
async def purge(self, ctx, limit: int=100):
|
async def purge(self, ctx, limit: int = 100):
|
||||||
"""This command is used to a purge a number of messages from the channel"""
|
"""This command is used to a purge a number of messages from the channel"""
|
||||||
await self.bot.purge_from(ctx.message.channel,limit=limit)
|
await self.bot.purge_from(ctx.message.channel, limit=limit)
|
||||||
|
|
||||||
@commands.group(aliases=['rule'], pass_context=True, no_pm=True, invoke_without_command=True)
|
@commands.group(aliases=['rule'], pass_context=True, no_pm=True, invoke_without_command=True)
|
||||||
@checks.customPermsOrRole(send_messages=True)
|
@checks.customPermsOrRole(send_messages=True)
|
||||||
|
@ -198,7 +199,7 @@ class Mod:
|
||||||
|
|
||||||
@rules.command(name='remove', aliases=['delete'], pass_context=True, no_pm=True)
|
@rules.command(name='remove', aliases=['delete'], pass_context=True, no_pm=True)
|
||||||
@checks.customPermsOrRole(manage_server=True)
|
@checks.customPermsOrRole(manage_server=True)
|
||||||
async def rules_delete(self, ctx, rule: int=None):
|
async def rules_delete(self, ctx, rule: int = None):
|
||||||
"""Removes one of the rules from the list of this server's rules
|
"""Removes one of the rules from the list of this server's rules
|
||||||
Provide a number to delete that rule; if no number is provided
|
Provide a number to delete that rule; if no number is provided
|
||||||
I'll print your current rules and ask for a number"""
|
I'll print your current rules and ask for a number"""
|
||||||
|
|
Loading…
Reference in a new issue