1
0
Fork 0
mirror of synced 2024-05-20 20:42:27 +12:00

Update no_pm to use the decorator instead

This commit is contained in:
Phxntxm 2017-04-08 22:04:46 -05:00
parent 6029797f1c
commit 74d22f2d8d
15 changed files with 182 additions and 94 deletions

View file

@ -36,7 +36,8 @@ class Blackjack:
game = Game(self.bot, message, self)
self.games[message.guild.id] = game
@commands.group(no_pm=True, aliases=['bj'], invoke_without_command=True)
@commands.group(aliases=['bj'], invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def blackjack(self, ctx):
"""Creates a game/joins the current running game of blackjack
@ -62,7 +63,8 @@ class Blackjack:
else:
await ctx.send("There are already a max number of players playing/waiting to play!")
@blackjack.command(no_pm=True, name='leave', aliases=['quit'])
@blackjack.command(name='leave', aliases=['quit'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def blackjack_leave(self, ctx):
"""Leaves the current game of blackjack
@ -83,7 +85,8 @@ class Blackjack:
else:
await ctx.send("Either you have already bet, or you are not even playing right now!")
@blackjack.command(no_pm=True, name='forcestop', aliases=['stop'])
@blackjack.command(name='forcestop', aliases=['stop'])
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
async def blackjack_stop(self, ctx):
"""Forces the game to stop, mostly for use if someone has gone afk

View file

@ -19,7 +19,8 @@ class Music:
async def on_voice_state_update(self, member, before, after):
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def progress(self, ctx):
"""Provides the progress of the current song
@ -28,7 +29,8 @@ class Music:
RESULT: 532 minutes! (Hopefully not)"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def join(self, ctx, *, channel: discord.TextChannel):
"""Joins a voice channel.
@ -37,7 +39,8 @@ class Music:
RESULT: I'm in the Music voice channel!"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def summon(self, ctx):
"""Summons the bot to join your voice channel.
@ -46,7 +49,8 @@ class Music:
RESULT: I'm in your voice channel!"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def play(self, ctx, *, song: str):
"""Plays a song.
@ -61,7 +65,8 @@ class Music:
"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(kick_members=True)
async def volume(self, ctx, value: int = None):
"""Sets the volume of the currently playing song.
@ -70,7 +75,8 @@ class Music:
RESULT: My volume is now set to 50"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(kick_members=True)
async def pause(self, ctx):
"""Pauses the currently played song.
@ -79,7 +85,8 @@ class Music:
RESULT: I'm paused!"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(kick_members=True)
async def resume(self, ctx):
"""Resumes the currently played song.
@ -88,7 +95,8 @@ class Music:
RESULT: Ain't paused no more!"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(kick_members=True)
async def stop(self, ctx):
"""Stops playing audio and leaves the voice channel.
@ -98,7 +106,8 @@ class Music:
RESULT: No more music"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def eta(self, ctx):
"""Provides an ETA on when your next song will play
@ -107,7 +116,8 @@ class Music:
RESULT: 5,000 days! Lol have fun"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def queue(self, ctx):
"""Provides a printout of the songs that are in the queue.
@ -121,7 +131,8 @@ class Music:
RESULT: A list of shitty songs you probably don't wanna listen to"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def queuelength(self, ctx):
"""Prints the length of the queue
@ -130,7 +141,8 @@ class Music:
RESULT: Probably 10 songs"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def skip(self, ctx):
"""Vote to skip a song. The song requester can automatically skip.
@ -142,7 +154,8 @@ class Music:
"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(kick_members=True)
async def modskip(self, ctx):
"""Forces a song skip, can only be used by a moderator
@ -151,7 +164,8 @@ class Music:
RESULT: No more terrible song :D"""
pass
@commands.command(no_pm=True, enabled=False)
@commands.command(enabled=False)
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def playing(self, ctx):
"""Shows info about the currently played song.

View file

@ -76,7 +76,8 @@ class Hangman:
game.author = ctx.message.author.id
return game
@commands.group(aliases=['hm'], no_pm=True, invoke_without_command=True)
@commands.group(aliases=['hm'], invoke_without_command=True)
@commands.guild_only()
@commands.cooldown(1, 7, BucketType.user)
@checks.custom_perms(send_messages=True)
async def hangman(self, ctx, *, guess):
@ -124,7 +125,8 @@ class Hangman:
await ctx.send(fmt)
@hangman.command(name='create', aliases=['start'], no_pm=True)
@hangman.command(name='create', aliases=['start'])
@commands.guild_only()
@checks.custom_perms(send_messages=True)
async def create_hangman(self, ctx):
"""This is used to create a new hangman game
@ -166,7 +168,8 @@ class Hangman:
await ctx.send(
"Alright, a hangman game has just started, you can start guessing now!\n{}".format(str(game)))
@hangman.command(name='delete', aliases=['stop', 'remove', 'end'], no_pm=True)
@hangman.command(name='delete', aliases=['stop', 'remove', 'end'])
@commands.guild_only()
@checks.custom_perms(kick_members=True)
async def stop_game(self, ctx):
"""Force stops a game of hangman

View file

@ -109,7 +109,8 @@ class Interaction:
self.battles[ctx.message.guild.id] = {p1: p2 for p1, p2 in battles.items() if
not p2 == player_id and not p1 == player_id}
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def hug(self, ctx, user: discord.Member = None):
"""Makes me hug a person!
@ -122,7 +123,8 @@ class Interaction:
fmt = random.SystemRandom().choice(hugs)
await ctx.send(fmt.format(user.display_name))
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def avatar(self, ctx, member: discord.Member = None):
"""Provides an image for the provided person's avatar (yours if no other member is provided)
@ -148,7 +150,8 @@ class Interaction:
else:
await ctx.send(url)
@commands.group(no_pm=True, invoke_without_command=True)
@commands.group(invoke_without_command=True)
@commands.guild_only()
@commands.cooldown(1, 180, BucketType.user)
@utils.custom_perms(send_messages=True)
async def battle(self, ctx, player2: discord.Member):
@ -180,7 +183,8 @@ class Interaction:
self.bot.loop.call_later(180, self.battling_off, ctx)
await ctx.send(fmt.format(ctx, player2))
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def accept(self, ctx):
"""Accepts the battle challenge
@ -216,7 +220,8 @@ class Interaction:
await ctx.send(fmt.format(battleP2.mention, battleP1.mention))
await utils.update_records('battle_records', battleP2, battleP1)
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def decline(self, ctx):
"""Declines the battle challenge
@ -242,7 +247,8 @@ class Interaction:
self.battling_off(ctx)
await ctx.send("{0} has chickened out! What a loser~".format(battleP2.mention, battleP1.mention))
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@commands.cooldown(1, 180, BucketType.user)
@utils.custom_perms(send_messages=True)
async def boop(self, ctx, boopee: discord.Member = None, *, message=""):

View file

@ -16,7 +16,8 @@ class Mod:
def __init__(self, bot):
self.bot = bot
@commands.command(no_pm=True, aliases=['nick'])
@commands.command(aliases=['nick'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def nickname(self, ctx, *, name=None):
"""Used to set the nickname for Bonfire (provide no nickname and it will reset)
@ -30,7 +31,8 @@ class Mod:
else:
await ctx.send("\N{OK HAND SIGN}")
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def kick(self, ctx, member: discord.Member):
"""Used to kick a member from this server
@ -43,7 +45,8 @@ class Mod:
except discord.Forbidden:
await ctx.send("But I can't, muh permissions >:c")
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(ban_members=True)
async def unban(self, ctx, member_id: int):
"""Used to unban a member from this server
@ -63,7 +66,8 @@ class Mod:
except discord.HTTPException:
await ctx.send("Sorry, I failed to unban that user!")
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(ban_members=True)
async def ban(self, ctx, *, member):
"""Used to ban a member
@ -104,7 +108,8 @@ class Mod:
except discord.HTTPException:
await ctx.send("Sorry, I failed to ban that user!")
@commands.command(no_pm=True, aliases=['alerts'])
@commands.command(aliases=['alerts'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def notifications(self, ctx, channel: discord.TextChannel):
"""This command is used to set a channel as the server's 'notifications' channel
@ -120,7 +125,8 @@ class Mod:
await ctx.send("I have just changed this server's 'notifications' channel"
"\nAll notifications will now go to `{}`".format(channel))
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def usernotify(self, ctx, on_off: str):
"""This command can be used to set whether or not you want user notificaitons to show
@ -217,7 +223,8 @@ class Mod:
except:
pass
@commands.group(invoke_without_command=True, no_pm=True)
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def perms(self, ctx, *, command: str = None):
"""This command can be used to print the current allowed permissions on a specific command
@ -273,7 +280,8 @@ class Mod:
await ctx.send("You need to have the permission `{}` "
"to use the command `{}` in this server".format(needed_perm, command))
@perms.command(name="add", aliases=["setup,create"], no_pm=True)
@perms.command(name="add", aliases=["setup,create"])
@commands.guild_only()
@commands.has_permissions(manage_guild=True)
async def add_perms(self, ctx, *msg: str):
"""Sets up custom permissions on the provided command
@ -337,7 +345,8 @@ class Mod:
await ctx.send("I have just added your custom permissions; "
"you now need to have `{}` permissions to use the command `{}`".format(permissions, command))
@perms.command(name="remove", aliases=["delete"], no_pm=True)
@perms.command(name="remove", aliases=["delete"])
@commands.guild_only()
@commands.has_permissions(manage_guild=True)
async def remove_perms(self, ctx, *, command: str):
"""Removes the custom permissions setup on the command specified
@ -356,7 +365,8 @@ class Mod:
await utils.update_content('server_settings', update, str(ctx.message.guild.id))
await ctx.send("I have just removed the custom permissions for {}!".format(cmd))
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
async def prefix(self, ctx, *, prefix: str):
"""This command can be used to set a custom prefix per server
@ -383,7 +393,8 @@ class Mod:
"For example, you can call this command again with {0}prefix".format(prefix)
await ctx.send(fmt)
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_messages=True)
async def purge(self, ctx, limit: int = 100):
"""This command is used to a purge a number of messages from the channel
@ -401,7 +412,8 @@ class Mod:
"back for me to delete; I can only bulk delete messages"
" that are under 14 days old.")
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_messages=True)
async def prune(self, ctx, limit=None):
"""This command can be used to prune messages from certain members
@ -466,7 +478,8 @@ class Mod:
except:
pass
@commands.group(aliases=['rule'], no_pm=True, invoke_without_command=True)
@commands.group(aliases=['rule'], invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def rules(self, ctx, rule: int = None):
"""This command can be used to view the current rules on the server
@ -499,7 +512,8 @@ class Mod:
return
await ctx.send("Rule {}: \"{}\"".format(rule, fmt))
@rules.command(name='add', aliases=['create'], no_pm=True)
@rules.command(name='add', aliases=['create'])
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
async def rules_add(self, ctx, *, rule: str):
"""Adds a rule to this server's rules
@ -521,7 +535,8 @@ class Mod:
await ctx.send("I have just saved your new rule, use the rules command to view this server's current rules")
@rules.command(name='remove', aliases=['delete'], no_pm=True)
@rules.command(name='remove', aliases=['delete'])
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
async def rules_delete(self, ctx, rule: int):
"""Removes one of the rules from the list of this server's rules

View file

@ -350,7 +350,8 @@ class Music:
await ctx.send(python.format(result))
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def progress(self, ctx):
"""Provides the progress of the current song"""
@ -374,7 +375,8 @@ class Music:
fmt = "Current song progress: {0[0]}m {0[1]}s/{1[0]}m {1[1]}s".format(progress, length)
await ctx.send(fmt)
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def join(self, *, channel: discord.TextChannel):
"""Joins a voice channel."""
@ -391,7 +393,8 @@ class Music:
else:
await ctx.send('Ready to play audio in ' + channel.name)
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def summon(self, ctx):
"""Summons the bot to join your voice channel."""
@ -419,7 +422,8 @@ class Music:
pass
return success
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def play(self, ctx, *, song: str):
"""Plays a song.
@ -504,7 +508,8 @@ class Music:
return
await ctx.send('Enqueued ' + str(_entry))
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def volume(self, ctx, value: int = None):
"""Sets the volume of the currently playing song."""
@ -523,7 +528,8 @@ class Music:
player.volume = value / 100
await ctx.send('Set the volume to {:.0%}'.format(player.volume))
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def pause(self, ctx):
"""Pauses the currently played song."""
@ -531,7 +537,8 @@ class Music:
if state.is_playing():
state.player.pause()
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def resume(self, ctx):
"""Resumes the currently played song."""
@ -539,7 +546,8 @@ class Music:
if state.is_playing():
state.player.resume()
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def stop(self, ctx):
"""Stops playing audio and leaves the voice channel.
@ -564,7 +572,8 @@ class Music:
except:
pass
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def eta(self, ctx):
"""Provides an ETA on when your next song will play"""
@ -604,7 +613,8 @@ class Music:
return
await ctx.send("ETA till your next play is: {0[0]}m {0[1]}s".format(divmod(round(count, 0), 60)))
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def queue(self, ctx):
"""Provides a printout of the songs that are in the queue"""
@ -620,14 +630,16 @@ class Music:
else:
self.bot.loop.create_task(self.queue_embed_task(state, ctx.message.channel, ctx.message.author))
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def queuelength(self, ctx):
"""Prints the length of the queue"""
await ctx.send("There are a total of {} songs in the queue"
.format(len(self.get_voice_state(ctx.message.guild).songs.entries)))
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def skip(self, ctx):
"""Vote to skip a song. The song requester can automatically skip.
@ -659,7 +671,8 @@ class Music:
else:
await ctx.send('You have already voted to skip this song.')
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def modskip(self, ctx):
"""Forces a song skip, can only be used by a moderator"""
@ -671,7 +684,8 @@ class Music:
state.skip()
await ctx.send('Song has just been skipped.')
@commands.command(pass_context=True, no_pm=True)
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def playing(self, ctx):
"""Shows info about the currently played song."""

View file

@ -19,7 +19,7 @@ class Overwatch:
def __init__(self, bot):
self.bot = bot
@commands.group(no_pm=True)
@commands.group()
async def ow(self):
"""Command used to lookup information on your own user, or on another's
When adding your battletag, it is quite picky, use the exact format user#xxxx

View file

@ -98,7 +98,7 @@ class Picarto:
fmt = "{1}\n{0.__class__.__name__}: {0}".format(tb, e)
log.error(fmt)
@commands.group(invoke_without_command=True, no_pm=True)
@commands.group(invoke_without_command=True)
@utils.custom_perms(send_messages=True)
async def picarto(self, ctx, member: discord.Member = None):
"""This command can be used to view Picarto stats about a certain member
@ -148,7 +148,8 @@ class Picarto:
await ctx.send(embed=embed)
@picarto.command(name='add', no_pm=True)
@picarto.command(name='add')
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def add_picarto_url(self, ctx, url: str):
"""Saves your user's picarto URL
@ -195,7 +196,7 @@ class Picarto:
await utils.update_content('picarto', {'picarto_url': url}, key)
await ctx.send("I have just updated your Picarto URL")
@picarto.command(name='remove', aliases=['delete'], no_pm=True)
@picarto.command(name='remove', aliases=['delete'])
@utils.custom_perms(send_messages=True)
async def remove_picarto_url(self, ctx):
"""Removes your picarto URL"""
@ -206,7 +207,8 @@ class Picarto:
"I do not have your picarto URL added {}. You can save your picarto url with {}picarto add".format(
ctx.message.author.mention, ctx.prefix))
@picarto.group(no_pm=True, invoke_without_command=True)
@picarto.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def notify(self, ctx):
"""This can be used to turn picarto notifications on or off
@ -227,7 +229,7 @@ class Picarto:
else:
await utils.update_content('picarto', {'servers': r.row['servers'].append(str(ctx.message.guild.id))}, key)
@notify.command(name='on', aliases=['start,yes'], no_pm=True)
@notify.command(name='on', aliases=['start,yes'])
@utils.custom_perms(send_messages=True)
async def notify_on(self, ctx):
"""Turns picarto notifications on
@ -238,7 +240,7 @@ class Picarto:
await ctx.send("I will notify if you go live {}, you'll get a bajillion followers I promise c:".format(
ctx.message.author.mention))
@notify.command(name='off', aliases=['stop,no'], pass_context=True, no_pm=True)
@notify.command(name='off', aliases=['stop,no'], pass_context=True)
@utils.custom_perms(send_messages=True)
async def notify_off(self, ctx):
"""Turns picarto notifications off

View file

@ -87,7 +87,8 @@ class Raffle:
except discord.Forbidden:
pass
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def raffles(self, ctx):
"""Used to print the current running raffles on the server
@ -107,7 +108,8 @@ class Raffle:
raffle['expires']) for num, raffle in enumerate(raffles))
await ctx.send(fmt)
@commands.group(no_pm=True, invoke_without_command=True)
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def raffle(self, ctx, raffle_id: int = 0):
"""Used to enter a raffle running on this server
@ -159,7 +161,8 @@ class Raffle:
raffle_count, ctx.prefix)
await ctx.send(fmt)
@raffle.command(pass_context=True, no_pm=True, name='create', aliases=['start', 'begin', 'add'])
@raffle.command(pass_context=True, name='create', aliases=['start', 'begin', 'add'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def raffle_create(self, ctx):
"""This is used in order to create a new server raffle

View file

@ -13,7 +13,8 @@ class Roles:
def __init__(self, bot):
self.bot = bot
@commands.group(aliases=['roles'], invoke_without_command=True, no_pm=True)
@commands.group(aliases=['roles'], invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def role(self, ctx):
"""This command can be used to modify the roles on the server.
@ -25,7 +26,8 @@ class Roles:
server_roles = [role.name for role in ctx.message.guild.roles if not role.is_default()]
await ctx.send("Your server's roles are: ```\n{}```".format("\n".join(server_roles)))
@role.command(name='remove', no_pm=True)
@role.command(name='remove')
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
async def remove_role(self, ctx):
"""Use this to remove roles from a number of members
@ -86,7 +88,8 @@ class Roles:
await ctx.send("I have just removed the following roles:```\n{}``` from the following members:"
"```\n{}```".format("\n".join(role_names), "\n".join([m.display_name for m in members])))
@role.command(name='add', no_pm=True)
@role.command(name='add')
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
async def add_role(self, ctx):
"""Use this to add a role to multiple members.
@ -141,7 +144,8 @@ class Roles:
await ctx.send("I have just added the following roles:```\n{}``` to the following members:"
"```\n{}```".format("\n".join(role_names), "\n".join([m.display_name for m in members])))
@role.command(name='delete', no_pm=True)
@role.command(name='delete')
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
async def delete_role(self, ctx, *, role: discord.Role = None):
"""This command can be used to delete one of the roles from the server
@ -182,7 +186,8 @@ class Roles:
await role.delete()
await ctx.send("I have just removed the role {} from this server".format(role.name))
@role.command(name='create', no_pm=True)
@role.command(name='create')
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
async def create_role(self, ctx):
"""This command can be used to create a new role for this server

View file

@ -33,7 +33,8 @@ class Roulette:
self.roulettes.remove(game)
return member
@commands.group(no_pm=True, invoke_without_command=True)
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def roulette(self, ctx):
"""Joins the current running roulette
@ -52,6 +53,7 @@ class Roulette:
await ctx.send("This roulette will end in " + time_left)
@roulette.command(name='start', aliases=['create'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def roulette_start(self, ctx, time: int=5):
"""Starts a roulette, that will end in one of the entrants being kicked from the server

View file

@ -12,7 +12,8 @@ class Stats:
def __init__(self, bot):
self.bot = bot
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def serverinfo(self, ctx):
"""Provides information about the server
@ -44,12 +45,13 @@ class Stats:
await ctx.send(embed=embed)
@commands.group(no_pm=True, pass_context=False)
@commands.group(pass_context=False)
@utils.custom_perms(send_messages=True)
async def command(self):
pass
@command.command(no_pm=True, name="stats")
@command.command(name="stats")
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def command_stats(self, ctx, *, command):
"""This command can be used to view some usage stats about a specific command
@ -87,7 +89,7 @@ class Stats:
await ctx.send(fmt)
@command.command(no_pm=True, name="leaderboard")
@command.command(name="leaderboard")
@utils.custom_perms(send_messages=True)
async def command_leaderboard(self, ctx, option="server"):
"""This command can be used to print a leaderboard of commands
@ -138,7 +140,8 @@ class Stats:
else:
await ctx.send("That is not a valid option, valid options are: `server` or `me`")
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def mostboops(self, ctx):
"""Shows the person you have 'booped' the most, as well as how many times
@ -169,7 +172,8 @@ class Stats:
await ctx.send("{0} you have booped {1} the most amount of times, coming in at {2} times".format(
ctx.message.author.mention, member.display_name, most_boops))
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def listboops(self, ctx):
"""Lists all the users you have booped and the amount of times
@ -204,7 +208,8 @@ class Stats:
m_id, amt in sorted_booped_members)
await ctx.send("You have booped:```\n{}```".format(output))
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def leaderboard(self, ctx):
"""Prints a leaderboard of everyone in the server's battling record
@ -237,7 +242,8 @@ class Stats:
except utils.CannotPaginate as e:
await ctx.send(str(e))
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def stats(self, ctx, member: discord.Member = None):
"""Prints the battling stats for you, or the user provided

View file

@ -12,7 +12,8 @@ class Tags:
def __init__(self, bot):
self.bot = bot
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def tags(self, ctx):
"""Prints all the custom tags that this server currently has
@ -27,7 +28,8 @@ class Tags:
else:
await ctx.send("There are no tags setup on this server!")
@commands.command(no_pm=True)
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def mytags(self, ctx):
"""Prints all the custom tags that this server that you own
@ -45,7 +47,8 @@ class Tags:
pages = utils.Pages(self.bot, message=ctx.message, entries=entries)
await pages.paginate()
@commands.group(invoke_without_command=True, no_pm=True)
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def tag(self, ctx, *, tag: str):
"""This can be used to call custom tags
@ -65,7 +68,8 @@ class Tags:
await ctx.send("There are no tags setup on this server!")
@tag.command(name='add', aliases=['create', 'setup'], no_pm=True)
@tag.command(name='add', aliases=['create', 'setup'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def add_tag(self, ctx):
"""Use this to add a new tag that can be used in this server
@ -131,7 +135,8 @@ class Tags:
await utils.update_content('tags', {'tags': r.row['tags'].append(tag)}, key)
await ctx.send("I have just setup a new tag for this server! You can call your tag with {}".format(trigger))
@tag.command(name='edit', no_pm=True)
@tag.command(name='edit')
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def edit_tag(self, ctx, *, tag: str):
"""This will allow you to edit a tag that you have created
@ -171,7 +176,8 @@ class Tags:
await ctx.send("There are no tags setup on this server!")
@tag.command(name='delete', aliases=['remove', 'stop'], no_pm=True)
@tag.command(name='delete', aliases=['remove', 'stop'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def del_tag(self, ctx, *, tag: str):
"""Use this to remove a tag from use for this server

View file

@ -108,7 +108,8 @@ class TicTacToe:
# Return whoever is x's so that we know who is going first
return self.boards[server_id].challengers['x']
@commands.group(aliases=['tic', 'tac', 'toe'], no_pm=True, invoke_without_command=True)
@commands.group(aliases=['tic', 'tac', 'toe'], invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def tictactoe(self, ctx, *, option: str):
"""Updates the current server's tic-tac-toe board
@ -204,7 +205,8 @@ class TicTacToe:
fmt = str(board) + "\n{} It is now your turn to play!".format(player_turn.display_name)
await ctx.send(fmt)
@tictactoe.command(name='start', aliases=['challenge', 'create'], no_pm=True)
@tictactoe.command(name='start', aliases=['challenge', 'create'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def start_game(self, ctx, player2: discord.Member):
"""Starts a game of tictactoe with another player
@ -238,7 +240,8 @@ class TicTacToe:
.format(x_player.display_name, ctx.prefix)
await ctx.send(fmt)
@tictactoe.command(name='delete', aliases=['stop', 'remove', 'end'], no_pm=True)
@tictactoe.command(name='delete', aliases=['stop', 'remove', 'end'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
async def stop_game(self, ctx):
"""Force stops a game of tictactoe

View file

@ -95,7 +95,8 @@ class Twitch:
fmt = "{1}\n{0.__class__.__name__}: {0}".format(tb, e)
log.error(fmt)
@commands.group(no_pm=True, invoke_without_command=True)
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def twitch(self, ctx, *, member: discord.Member = None):
"""Use this command to check the twitch info of a user
@ -134,7 +135,8 @@ class Twitch:
await ctx.send(embed=embed)
@twitch.command(name='add', no_pm=True)
@twitch.command(name='add')
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def add_twitch_url(self, ctx, url: str):
"""Saves your user's twitch URL
@ -180,7 +182,8 @@ class Twitch:
await utils.update_content('twitch', update, key)
await ctx.send("I have just saved your twitch url {}".format(ctx.message.author.mention))
@twitch.command(name='remove', aliases=['delete'], no_pm=True)
@twitch.command(name='remove', aliases=['delete'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def remove_twitch_url(self, ctx):
"""Removes your twitch URL
@ -191,7 +194,8 @@ class Twitch:
await utils.remove_content('twitch', str(ctx.message.author.id))
await ctx.send("I am no longer saving your twitch URL {}".format(ctx.message.author.mention))
@twitch.group(no_pm=True, invoke_without_command=True)
@twitch.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def notify(self, ctx):
"""This can be used to modify notification settings for your twitch user
@ -213,7 +217,8 @@ class Twitch:
await utils.update_content('twitch', {'servers': r.row['servers'].append(str(ctx.message.guild.id))}, key)
await ctx.send("This server will now be notified if you go live")
@notify.command(name='on', aliases=['start,yes'], no_pm=True)
@notify.command(name='on', aliases=['start,yes'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def notify_on(self, ctx):
"""Turns twitch notifications on
@ -226,7 +231,8 @@ class Twitch:
else:
await ctx.send("I can't notify if you go live if I don't know your twitch URL yet!")
@notify.command(name='off', aliases=['stop,no'], no_pm=True)
@notify.command(name='off', aliases=['stop,no'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
async def notify_off(self, ctx):
"""Turns twitch notifications off