1
0
Fork 0
mirror of synced 2024-05-19 20:12:30 +12:00

Add the restriction checking decorator to all commands

This commit is contained in:
phxntxm 2017-06-27 19:26:32 -05:00
parent da114970fb
commit ab93c3f436
22 changed files with 135 additions and 8 deletions

View file

@ -16,6 +16,7 @@ class Administration:
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def restrict(self, ctx, *options):
"""
This is an intuitive command to restrict something to/from something
@ -238,6 +239,7 @@ class Administration:
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def unrestrict(self, ctx, *options):
"""
This is an intuitive command to unrestrict something to/from something
@ -335,6 +337,7 @@ class Administration:
@commands.command(aliases=['nick'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def nickname(self, ctx, *, name=None):
"""Used to set the nickname for Bonfire (provide no nickname and it will reset)
@ -350,6 +353,7 @@ class Administration:
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def ignore(self, ctx, member_or_channel):
"""This command can be used to have Bonfire ignore certain members/channels
@ -401,6 +405,7 @@ class Administration:
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def unignore(self, ctx, member_or_channel):
"""This command can be used to have Bonfire stop ignoring certain members/channels
@ -449,6 +454,7 @@ class Administration:
@commands.command(aliases=['notifications'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def alerts(self, ctx, channel: discord.TextChannel):
"""This command is used to set a channel as the server's default 'notifications' channel
Any notifications (like someone going live on Twitch, or Picarto) will go to that channel by default
@ -471,6 +477,7 @@ class Administration:
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def welcome(self, ctx, on_off: str):
"""This command can be used to set whether or not you want user notificaitons to show
Provide on, yes, or true to set it on; otherwise it will be turned off
@ -494,6 +501,7 @@ class Administration:
@welcome.command(name='alerts', aliases=['notifications'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def _welcome_alerts(self, ctx, *, channel: discord.TextChannel):
"""A command used to set the override for notifications about users joining/leaving
@ -511,6 +519,7 @@ class Administration:
"I have just changed this server's welcome/goodbye notifications channel to {}".format(channel.name))
@commands.group()
@utils.check_restricted()
async def nsfw(self, ctx):
"""Handles adding or removing a channel as a nsfw channel"""
# This command isn't meant to do anything, so just send an error if an invalid subcommand is passed
@ -518,6 +527,7 @@ class Administration:
@nsfw.command(name="add")
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def nsfw_add(self, ctx):
"""Registers this channel as a 'nsfw' channel
@ -543,6 +553,7 @@ class Administration:
@nsfw.command(name="remove", aliases=["delete"])
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def nsfw_remove(self, ctx):
"""Removes this channel as a 'nsfw' channel
@ -570,6 +581,7 @@ class Administration:
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def perms(self, ctx, *, command: str = None):
"""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
@ -623,6 +635,7 @@ class Administration:
@perms.command(name="add", aliases=["setup,create"])
@commands.guild_only()
@commands.has_permissions(manage_guild=True)
@utils.check_restricted()
async def add_perms(self, ctx, *msg: str):
"""Sets up custom permissions on the provided command
Format must be 'perms add <command> <permission>'
@ -688,6 +701,7 @@ class Administration:
@perms.command(name="remove", aliases=["delete"])
@commands.guild_only()
@commands.has_permissions(manage_guild=True)
@utils.check_restricted()
async def remove_perms(self, ctx, *, command: str):
"""Removes the custom permissions setup on the command specified
@ -712,6 +726,7 @@ class Administration:
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def prefix(self, ctx, *, prefix: str):
"""This command can be used to set a custom prefix per server
@ -741,6 +756,7 @@ class Administration:
@commands.group(aliases=['rule'], invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def rules(self, ctx, rule: int = None):
"""This command can be used to view the current rules on the server
@ -770,6 +786,7 @@ class Administration:
@rules.command(name='add', aliases=['create'])
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def rules_add(self, ctx, *, rule: str):
"""Adds a rule to this server's rules
@ -791,6 +808,7 @@ class Administration:
@rules.command(name='remove', aliases=['delete'])
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def rules_delete(self, ctx, rule: int):
"""Removes one of the rules from the list of this server's rules
Provide a number to delete that rule
@ -813,6 +831,7 @@ class Administration:
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def queuetype(self, ctx, new_type=None):
"""Switches the song queue type for music
Choices are `user` or `song` queue

View file

@ -39,6 +39,7 @@ class Blackjack:
@commands.group(aliases=['bj'], invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def blackjack(self, ctx):
"""Creates a game/joins the current running game of blackjack
@ -66,6 +67,7 @@ class Blackjack:
@blackjack.command(name='leave', aliases=['quit'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def blackjack_leave(self, ctx):
"""Leaves the current game of blackjack
@ -88,6 +90,7 @@ class Blackjack:
@blackjack.command(name='forcestop', aliases=['stop'])
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def blackjack_stop(self, ctx):
"""Forces the game to stop, mostly for use if someone has gone afk

View file

@ -5,7 +5,6 @@ import discord
from .utils import checks
import re
import random
import asyncio
@ -81,6 +80,7 @@ class Hangman:
@commands.guild_only()
@commands.cooldown(1, 7, BucketType.user)
@checks.custom_perms(send_messages=True)
@checks.check_restricted()
async def hangman(self, ctx, *, guess):
"""Makes a guess towards the server's currently running hangman game
@ -129,6 +129,7 @@ class Hangman:
@hangman.command(name='create', aliases=['start'])
@commands.guild_only()
@checks.custom_perms(send_messages=True)
@checks.check_restricted()
async def create_hangman(self, ctx):
"""This is used to create a new hangman game
A predefined phrase will be randomly chosen as the phrase to use
@ -180,6 +181,7 @@ class Hangman:
@hangman.command(name='delete', aliases=['stop', 'remove', 'end'])
@commands.guild_only()
@checks.custom_perms(kick_members=True)
@checks.check_restricted()
async def stop_game(self, ctx):
"""Force stops a game of hangman
This should realistically only be used in a situation like one player leaves

View file

@ -15,6 +15,7 @@ class Images:
@commands.command(aliases=['rc'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def cat(self, ctx):
"""Use this to print a random cat image.
@ -36,6 +37,7 @@ class Images:
@commands.command(aliases=['dog', 'rd'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def doggo(self, ctx):
"""Use this to print a random doggo image.
@ -55,6 +57,7 @@ class Images:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def snek(self, ctx):
"""Use this to print a random snek image.
@ -68,6 +71,7 @@ class Images:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
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)
@ -98,6 +102,7 @@ class Images:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def derpi(self, ctx, *search: str):
"""Provides a random image from the first page of derpibooru.org for the following term
@ -166,6 +171,7 @@ class Images:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def e621(self, ctx, *, tags: str):
"""Searches for a random image from e621.net
Format for the search terms need to be 'search term 1, search term 2, etc.'

View file

@ -147,6 +147,7 @@ class Interaction:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def hug(self, ctx, user: discord.Member = None):
"""Makes me hug a person!
@ -162,6 +163,7 @@ class Interaction:
@commands.guild_only()
@commands.cooldown(1, 20, BucketType.user)
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def battle(self, ctx, player2: discord.Member):
"""Challenges the mentioned user to a battle
@ -197,6 +199,7 @@ class Interaction:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def accept(self, ctx):
"""Accepts the battle challenge
@ -233,6 +236,7 @@ class Interaction:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def decline(self, ctx):
"""Declines the battle challenge
@ -260,6 +264,7 @@ class Interaction:
@commands.guild_only()
@commands.cooldown(1, 10, BucketType.user)
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def boop(self, ctx, boopee: discord.Member = None, *, message=""):
"""Boops the mentioned person

View file

@ -17,6 +17,7 @@ class Links:
@commands.command(aliases=['g'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def google(self, ctx, *, query: str):
"""Searches google for a provided query
@ -71,6 +72,7 @@ class Links:
@commands.command(aliases=['yt'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def youtube(self, ctx, *, query: str):
"""Searches youtube for a provided query
@ -106,6 +108,7 @@ class Links:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def wiki(self, ctx, *, query: str):
"""Pulls the top match for a specific term from wikipedia, and returns the result
@ -145,6 +148,7 @@ class Links:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def urban(self, ctx, *, msg: str):
"""Pulls the top urbandictionary.com definition for a term

View file

@ -24,6 +24,7 @@ class Miscallaneous:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def help(self, ctx, *, command=None):
"""This command is used to provide a link to the help URL.
This can be called on a command to provide more information about that command
@ -107,6 +108,7 @@ class Miscallaneous:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def say(self, ctx, *, msg: str):
"""Tells the bot to repeat what you say
@ -121,6 +123,7 @@ class Miscallaneous:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def calendar(self, ctx, month: str = None, year: int = None):
"""Provides a printout of the current month's calendar
Provide month and year to print the calendar of that year and month
@ -160,6 +163,7 @@ class Miscallaneous:
@commands.command(aliases=['about'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def info(self, ctx):
"""This command can be used to print out some of my information"""
# fmt is a dictionary so we can set the key to it's output, then print both
@ -218,6 +222,7 @@ class Miscallaneous:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def uptime(self, ctx):
"""Provides a printout of the current bot's uptime
@ -230,6 +235,7 @@ class Miscallaneous:
@commands.command(aliases=['invite'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def addbot(self, ctx):
"""Provides a link that you can use to add me to a server
@ -255,6 +261,7 @@ class Miscallaneous:
@commands.command(enabled=False)
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def joke(self, ctx):
"""Prints a random riddle
@ -265,6 +272,7 @@ class Miscallaneous:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def roll(self, ctx, notation: str = "d6"):
"""Rolls a die based on the notation given
Format should be #d#

View file

@ -15,6 +15,7 @@ class Moderation:
@commands.command()
@commands.guild_only()
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def kick(self, ctx, member: discord.Member, *, reason=None):
"""Used to kick a member from this server
@ -29,6 +30,7 @@ class Moderation:
@commands.command()
@commands.guild_only()
@utils.custom_perms(ban_members=True)
@utils.check_restricted()
async def unban(self, ctx, member_id: int):
"""Used to unban a member from this server
Due to the fact that I cannot find a user without being in a server with them
@ -50,6 +52,7 @@ class Moderation:
@commands.command()
@commands.guild_only()
@utils.custom_perms(ban_members=True)
@utils.check_restricted()
async def ban(self, ctx, member, *, reason=None):
"""Used to ban a member
This can be used to ban someone preemptively as well.
@ -91,6 +94,7 @@ class Moderation:
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_messages=True)
@utils.check_restricted()
async def purge(self, ctx, limit: int = 100):
"""This command is used to a purge a number of messages from the channel
@ -110,6 +114,7 @@ class Moderation:
@commands.command()
@commands.guild_only()
@utils.custom_perms(manage_messages=True)
@utils.check_restricted()
async def prune(self, ctx, *specifications):
"""This command can be used to prune messages from certain members
Mention any user you want to prune messages from; if no members are mentioned, the messages removed will be mine

View file

@ -380,6 +380,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def progress(self, ctx):
"""Provides the progress of the current song"""
@ -405,6 +406,7 @@ class Music:
@commands.command(aliases=['summon'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def join(self, ctx, *, channel: discord.VoiceChannel = None):
"""Joins a voice channel. Provide the name of a voice channel after the command, and
I will attempt to join this channel. Otherwise, I will join the channel you are in.
@ -429,6 +431,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def play(self, ctx, *, song: str):
"""Plays a song.
If there is a song currently in the queue, then it is
@ -494,6 +497,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(mute_members=True)
@utils.check_restricted()
async def volume(self, ctx, value: int = None):
"""Sets the volume of the currently playing song."""
@ -513,6 +517,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(mute_members=True)
@utils.check_restricted()
async def pause(self, ctx):
"""Pauses the currently played song."""
state = self.voice_states.get(ctx.message.guild.id)
@ -522,6 +527,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(mute_members=True)
@utils.check_restricted()
async def resume(self, ctx):
"""Resumes the currently played song."""
state = self.voice_states.get(ctx.message.guild.id)
@ -531,6 +537,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(mute_members=True)
@utils.check_restricted()
async def stop(self, ctx):
"""Stops playing audio and leaves the voice channel.
This also clears the queue.
@ -557,6 +564,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def eta(self, ctx):
"""Provides an ETA on when your next song will play"""
state = self.voice_states.get(ctx.message.guild.id)
@ -593,6 +601,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def queue(self, ctx):
"""Provides a printout of the songs that are in the queue"""
state = self.voice_states.get(ctx.message.guild.id)
@ -612,6 +621,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def queuelength(self, ctx):
"""Prints the length of the queue"""
state = self.voice_states.get(ctx.message.guild.id)
@ -630,6 +640,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def skip(self, ctx):
"""Vote to skip a song. The song requester can automatically skip.
approximately 1/3 of the members in the voice channel
@ -669,6 +680,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(mute_members=True)
@utils.check_restricted()
async def modskip(self, ctx):
"""Forces a song skip, can only be used by a moderator"""
state = self.voice_states.get(ctx.message.guild.id)
@ -682,6 +694,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def playing(self, ctx):
"""Shows info about the currently played song."""
@ -711,6 +724,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def dj(self, ctx):
"""Attempts to join the current DJ queue
@ -752,6 +766,7 @@ class Music:
@commands.command()
@commands.guild_only()
@utils.custom_perms(mute_members=True)
@utils.check_restricted()
async def shuffle(self, ctx):
"""Shuffles the current playlist, be it users or songs

View file

@ -56,6 +56,7 @@ class Osu:
@commands.group(invoke_without_command=True)
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def osu(self, ctx, member: discord.Member = None):
"""Provides basic information about a specific user
@ -88,6 +89,7 @@ class Osu:
@osu.command(name='add', aliases=['create', 'connect'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def osu_add(self, ctx, *, username):
"""Links an osu account to your discord account
@ -111,6 +113,7 @@ class Osu:
@osu.command(name='score', aliases=['scores'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def osu_scores(self, ctx, *data):
"""Find the top x osu scores for a provided member
Note: You can only get the top 50 songs for a user

View file

@ -20,6 +20,7 @@ class Overwatch:
self.bot = bot
@commands.group()
@utils.check_restricted()
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
@ -29,6 +30,7 @@ class Overwatch:
@ow.command(name="stats")
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def ow_stats(self, ctx, user: discord.Member = None, hero: str = ""):
"""Prints out a basic overview of a member's stats
Provide a hero after the member to get stats for that specific hero
@ -89,6 +91,7 @@ class Overwatch:
@ow.command(pass_context=True, name="add")
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def add(self, ctx, bt: str):
"""Saves your battletag for looking up information
@ -121,6 +124,7 @@ class Overwatch:
@ow.command(pass_context=True, name="delete", aliases=['remove'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def delete(self, ctx):
"""Removes your battletag from the records

View file

@ -15,6 +15,12 @@ from contextlib import redirect_stdout
import io
def get_syntax_error(e):
if e.text is None:
return '```py\n{0.__class__.__name__}: {0}\n```'.format(e)
return '```py\n{0.text}{1:>{0.offset}}\n{2}: {0}```'.format(e, '^', type(e).__name__)
class Owner:
"""Commands that can only be used by Phantom, bot management commands"""
@ -32,11 +38,6 @@ class Owner:
# remove `foo`
return content.strip('` \n')
def get_syntax_error(self, e):
if e.text is None:
return '```py\n{0.__class__.__name__}: {0}\n```'.format(e)
return '```py\n{0.text}{1:>{0.offset}}\n{2}: {0}```'.format(e, '^', type(e).__name__)
async def on_guild_join(self, guild):
# Create our embed that we'll use for the information
embed = discord.Embed(title="Joined guild {}".format(guild.name), description="Created on: {}".format(guild.created_at.date()))
@ -146,7 +147,7 @@ class Owner:
try:
code = compile(cleaned, '<repl session>', 'exec')
except SyntaxError as e:
await ctx.send(self.get_syntax_error(e))
await ctx.send(get_syntax_error(e))
continue
variables['message'] = response
@ -217,7 +218,7 @@ class Owner:
try:
exec(to_compile, env)
except SyntaxError as e:
return await ctx.send(self.get_syntax_error(e))
return await ctx.send(get_syntax_error(e))
func = env['func']
try:

View file

@ -127,6 +127,7 @@ class Picarto:
@commands.group(invoke_without_command=True)
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def picarto(self, ctx, member: discord.Member = None):
"""This command can be used to view Picarto stats about a certain member
@ -148,6 +149,7 @@ class Picarto:
@picarto.command(name='add')
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def add_picarto_url(self, ctx, url: str):
"""Saves your user's picarto URL
@ -202,6 +204,7 @@ class Picarto:
@picarto.command(name='remove', aliases=['delete'])
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def remove_picarto_url(self, ctx):
"""Removes your picarto URL"""
entry = {
@ -215,6 +218,7 @@ class Picarto:
@picarto.command(name='alerts')
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def picarto_alerts_channel(self, ctx, channel: discord.TextChannel):
"""Sets the notifications channel for picarto notifications
@ -233,6 +237,7 @@ class Picarto:
@picarto.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def notify(self, ctx):
"""This can be used to turn picarto notifications on or off
Call this command by itself, to add this guild to the list of guilds to be notified
@ -261,6 +266,7 @@ class Picarto:
@notify.command(name='on', aliases=['start,yes'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def notify_on(self, ctx):
"""Turns picarto notifications on
@ -282,6 +288,7 @@ class Picarto:
@notify.command(name='off', aliases=['stop,no'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def notify_off(self, ctx):
"""Turns picarto notifications off

View file

@ -146,6 +146,7 @@ class Playlist:
@commands.command()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def playlists(self, ctx):
"""Displays the playlists you have
@ -172,6 +173,7 @@ class Playlist:
@commands.group(invoke_without_command=True)
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def playlist(self, ctx, *, playlist_name):
"""Used to view your playlists
@ -195,6 +197,7 @@ class Playlist:
@playlist.command(name='create')
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def _pl_create(self, ctx, *, name):
"""Used to create a new playlist
@ -229,6 +232,7 @@ class Playlist:
@playlist.command(name='edit')
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def _pl_edit(self, ctx):
"""A command used to edit a current playlist
The available ways to edit a playlist are to rename, add a song, remove a song, or delete the playlist

View file

@ -73,6 +73,7 @@ class Polls:
@commands.command(pass_context=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def poll(self, ctx, *, question):
"""Sets up a poll based on the question that you have provided.
Provide the question on the first line and the options on the following lines

View file

@ -97,6 +97,7 @@ class Raffle:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def raffles(self, ctx):
"""Used to print the current running raffles on the server
@ -123,6 +124,7 @@ class Raffle:
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def raffle(self, ctx, raffle_id: int = 0):
"""Used to enter a raffle running on this server
If there is more than one raffle running, provide an ID of the raffle you want to enter
@ -187,6 +189,7 @@ class Raffle:
@raffle.command(pass_context=True, name='create', aliases=['start', 'begin', 'add'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def raffle_create(self, ctx):
"""This is used in order to create a new server raffle
@ -277,6 +280,7 @@ class Raffle:
@raffle.command(name='alerts')
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def raffle_alerts_channel(self, ctx, channel: discord.TextChannel):
"""Sets the notifications channel for raffle notifications

View file

@ -16,6 +16,7 @@ class Roles:
@commands.group(aliases=['roles'], invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def role(self, ctx):
"""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
@ -37,6 +38,7 @@ class Roles:
@role.command(name='remove')
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
@utils.check_restricted()
async def remove_role(self, ctx):
"""Use this to remove roles from a number of members
@ -99,6 +101,7 @@ class Roles:
@role.command(name='add', aliases=['give', 'assign'])
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
@utils.check_restricted()
async def add_role(self, ctx):
"""Use this to add a role to multiple members.
Provide the list of members, and I'll ask for the role
@ -155,6 +158,7 @@ class Roles:
@role.command(name='delete')
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
@utils.check_restricted()
async def delete_role(self, ctx, *, role: discord.Role = None):
"""This command can be used to delete one of the roles from the server
@ -197,6 +201,7 @@ class Roles:
@role.command(name='create')
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
@utils.check_restricted()
async def create_role(self, ctx):
"""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
@ -313,6 +318,7 @@ class Roles:
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def assign(self, ctx, *role: discord.Role):
"""Assigns the provided role(s) to you, if they can be assigned
@ -346,6 +352,7 @@ class Roles:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def unassign(self, ctx, *role: discord.Role):
"""Unassigns the provided role(s) to you, if they can be assigned
@ -379,6 +386,7 @@ class Roles:
@assign.command(name='add')
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
@utils.check_restricted()
async def _add_assigns(self, ctx, *role: discord.Role):
"""Adds the provided role(s) to the list of available self-assignable roles
@ -408,6 +416,7 @@ class Roles:
@assign.command(name='list')
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def _list_assigns(self, ctx):
"""Lists the roles that can be self-assigned
@ -438,6 +447,7 @@ class Roles:
@assign.command(name='remove', aliases=['delete'])
@commands.guild_only()
@utils.custom_perms(manage_roles=True)
@utils.check_restricted()
async def _delete_assigns(self, ctx, *role: discord.Role):
"""Removes the provided role(s) from the list of available self-assignable roles

View file

@ -36,6 +36,7 @@ class Roulette:
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def roulette(self, ctx):
"""Joins the current running roulette
@ -55,6 +56,7 @@ class Roulette:
@roulette.command(name='start', aliases=['create'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
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
By default, the roulette will end in 5 minutes; provide a number (up to 30) to change how many minutes until it ends

View file

@ -15,6 +15,7 @@ class Stats:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def serverinfo(self, ctx):
"""Provides information about the server
@ -47,12 +48,14 @@ class Stats:
@commands.group(pass_context=False)
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def command(self):
pass
@command.command(name="stats")
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def command_stats(self, ctx, *, command):
"""This command can be used to view some usage stats about a specific command
@ -91,6 +94,7 @@ class Stats:
@command.command(name="leaderboard")
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def command_leaderboard(self, ctx, option="server"):
"""This command can be used to print a leaderboard of commands
Provide 'server' to print a leaderboard for this server
@ -143,6 +147,7 @@ class Stats:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def mostboops(self, ctx):
"""Shows the person you have 'booped' the most, as well as how many times
@ -175,6 +180,7 @@ class Stats:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def listboops(self, ctx):
"""Lists all the users you have booped and the amount of times
@ -211,6 +217,7 @@ class Stats:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def leaderboard(self, ctx):
"""Prints a leaderboard of everyone in the server's battling record
@ -245,6 +252,7 @@ class Stats:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def battlestats(self, ctx, member: discord.Member = None):
"""Prints the battling stats for you, or the user provided

View file

@ -15,6 +15,7 @@ class Tags:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def tags(self, ctx):
"""Prints all the custom tags that this server currently has
@ -31,6 +32,7 @@ class Tags:
@commands.command()
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def mytags(self, ctx):
"""Prints all the custom tags that this server that you own
@ -50,6 +52,7 @@ class Tags:
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def tag(self, ctx, *, tag: str):
"""This can be used to call custom tags
The format to call a custom tag is !tag <tag>
@ -70,6 +73,7 @@ class Tags:
@tag.command(name='add', aliases=['create', 'setup'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def add_tag(self, ctx):
"""Use this to add a new tag that can be used in this server
@ -149,6 +153,7 @@ class Tags:
@tag.command(name='edit')
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def edit_tag(self, ctx, *, tag: str):
"""This will allow you to edit a tag that you have created
EXAMPLE: !tag edit this tag
@ -194,6 +199,7 @@ class Tags:
@tag.command(name='delete', aliases=['remove', 'stop'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def del_tag(self, ctx, *, tag: str):
"""Use this to remove a tag from use for this server
Format to delete a tag is !tag delete <tag>

View file

@ -111,6 +111,7 @@ class TicTacToe:
@commands.group(aliases=['tic', 'tac', 'toe'], invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def tictactoe(self, ctx, *, option: str):
"""Updates the current server's tic-tac-toe board
You obviously need to be one of the players to use this
@ -208,6 +209,7 @@ class TicTacToe:
@tictactoe.command(name='start', aliases=['challenge', 'create'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def start_game(self, ctx, player2: discord.Member):
"""Starts a game of tictactoe with another player
@ -243,6 +245,7 @@ class TicTacToe:
@tictactoe.command(name='delete', aliases=['stop', 'remove', 'end'])
@commands.guild_only()
@utils.custom_perms(kick_members=True)
@utils.check_restricted()
async def stop_game(self, ctx):
"""Force stops a game of tictactoe
This should realistically only be used in a situation like one player leaves

View file

@ -141,6 +141,7 @@ class Twitch:
@commands.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def twitch(self, ctx, *, member: discord.Member = None):
"""Use this command to check the twitch info of a user
@ -162,6 +163,7 @@ class Twitch:
@twitch.command(name='add')
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def add_twitch_url(self, ctx, url: str):
"""Saves your user's twitch URL
@ -214,6 +216,7 @@ class Twitch:
@twitch.command(name='remove', aliases=['delete'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def remove_twitch_url(self, ctx):
"""Removes your twitch URL
@ -230,6 +233,7 @@ class Twitch:
@twitch.command(name='alerts', aliases=['notifications'])
@commands.guild_only()
@utils.custom_perms(manage_guild=True)
@utils.check_restricted()
async def twitch_alerts_channel(self, ctx, channel: discord.TextChannel):
"""Sets the notifications channel for twitch notifications
@ -248,6 +252,7 @@ class Twitch:
@twitch.group(invoke_without_command=True)
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def notify(self, ctx):
"""This can be used to modify notification settings for your twitch user
Call this command by itself to add 'this' server as one that will be notified when you on/offline
@ -276,6 +281,7 @@ class Twitch:
@notify.command(name='on', aliases=['start,yes'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def notify_on(self, ctx):
"""Turns twitch notifications on
@ -297,6 +303,7 @@ class Twitch:
@notify.command(name='off', aliases=['stop,no'])
@commands.guild_only()
@utils.custom_perms(send_messages=True)
@utils.check_restricted()
async def notify_off(self, ctx):
"""Turns twitch notifications off