1
0
Fork 0
mirror of synced 2024-09-30 09:17:13 +13:00

Added custom permissions accessiblity for all commands

This commit is contained in:
Phxntxm 2016-07-16 11:48:10 -05:00
parent d251d20e9a
commit 2e5135dd77
7 changed files with 29 additions and 1 deletions

View file

@ -19,6 +19,7 @@ class Core:
self.bot = bot self.bot = bot
@commands.command() @commands.command()
@checks.customPermsOrRole("none")
async def addbot(self): async def addbot(self):
"""Provides a link that you can use to add me to a server""" """Provides a link that you can use to add me to a server"""
perms = discord.Permissions.none() perms = discord.Permissions.none()
@ -36,6 +37,7 @@ class Core:
@commands.command(pass_context=True) @commands.command(pass_context=True)
@checks.customPermsOrRole("none")
async def doggo(self, ctx): async def doggo(self, ctx):
"""Use this to print a random doggo image. """Use this to print a random doggo image.
Doggo is love, doggo is life.""" Doggo is love, doggo is life."""
@ -47,6 +49,7 @@ class Core:
@commands.command() @commands.command()
@checks.customPermsOrRole("none")
async def joke(self): async def joke(self):
"""Prints a random riddle""" """Prints a random riddle"""
fortuneCommand = "/usr/bin/fortune riddles" fortuneCommand = "/usr/bin/fortune riddles"
@ -54,6 +57,7 @@ class Core:
await self.bot.say(fortune) await self.bot.say(fortune)
@commands.command() @commands.command()
@checks.customPermsOrRole("none")
async def urban(self, *msg: str): async def urban(self, *msg: str):
"""Pulls the top urbandictionary.com definition for a term""" """Pulls the top urbandictionary.com definition for a term"""
try: try:
@ -69,6 +73,7 @@ class Core:
await self.bot.say('```Error: Definition is too long for me to send```') await self.bot.say('```Error: Definition is too long for me to send```')
@commands.command(pass_context=True) @commands.command(pass_context=True)
@checks.customPermsOrRole("none")
async def derpi(self, ctx, *search: str): async def derpi(self, ctx, *search: str):
"""Provides a random image from the first page of derpibooru.org for the following term""" """Provides a random image from the first page of derpibooru.org for the following term"""
if len(search) > 0: if len(search) > 0:
@ -111,6 +116,7 @@ class Core:
await self.bot.say(response) await self.bot.say(response)
@commands.command(pass_context=True) @commands.command(pass_context=True)
@checks.customPermsOrRole("none")
async def roll(self, ctx, notation: str="d6"): async def roll(self, ctx, notation: str="d6"):
"""Rolls a die based on the notation given """Rolls a die based on the notation given
Format should be #d#""" Format should be #d#"""

View file

@ -57,6 +57,7 @@ class Interaction:
self.bot = bot self.bot = bot
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def battle(self, ctx, player2: discord.Member): async def battle(self, ctx, player2: discord.Member):
"""Challenges the mentioned user to a battle""" """Challenges the mentioned user to a battle"""
global battleP1 global battleP1
@ -85,6 +86,7 @@ class Interaction:
battling = True battling = True
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def accept(self, ctx): async def accept(self, ctx):
"""Accepts the battle challenge""" """Accepts the battle challenge"""
if not battling or battleP2 != ctx.message.author: if not battling or battleP2 != ctx.message.author:
@ -101,6 +103,7 @@ class Interaction:
battlingOff() battlingOff()
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def decline(self, ctx): async def decline(self, ctx):
"""Declines the battle challenge""" """Declines the battle challenge"""
if not battling or battleP2 != ctx.message.author: if not battling or battleP2 != ctx.message.author:
@ -110,6 +113,7 @@ class Interaction:
battlingOff() battlingOff()
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def boop(self, ctx, boopee: discord.Member): async def boop(self, ctx, boopee: discord.Member):
"""Boops the mentioned person""" """Boops the mentioned person"""
booper = ctx.message.author booper = ctx.message.author

View file

@ -22,6 +22,7 @@ class Overwatch:
pass pass
@ow.command(name="stats", pass_context=True, no_pm=True) @ow.command(name="stats", pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def ow_stats(self, ctx, user: discord.Member=None, hero: str=""): async def ow_stats(self, ctx, user: discord.Member=None, hero: str=""):
"""Command used to lookup information on your own user, or on another's """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 When adding your battletag, it is quite picky, use the exact format user#xxxx
@ -64,6 +65,7 @@ class Overwatch:
await self.bot.say("{} is not an actual hero!".format(hero.title())) await self.bot.say("{} is not an actual hero!".format(hero.title()))
@ow.command(pass_context=True, name="add", no_pm=True) @ow.command(pass_context=True, name="add", no_pm=True)
@checks.customPermsOrRole("none")
async def add(self, ctx, bt: str): async def add(self, ctx, bt: str):
"""Saves your battletag for looking up information""" """Saves your battletag for looking up information"""
bt = bt.replace("#", "-") bt = bt.replace("#", "-")
@ -88,6 +90,7 @@ class Overwatch:
config.closeConnection() config.closeConnection()
@ow.command(pass_context=True, name="delete", aliases=['remove'], no_pm=True) @ow.command(pass_context=True, name="delete", aliases=['remove'], no_pm=True)
@checks.customPermsOrRole("none")
async def delete(self, ctx): async def delete(self, ctx):
"""Removes your battletag from the records""" """Removes your battletag from the records"""
cursor = config.getCursor() cursor = config.getCursor()

View file

@ -35,7 +35,7 @@ class Owner:
@commands.command(pass_context=True) @commands.command(pass_context=True)
@commands.check(checks.isOwner) @commands.check(checks.isOwner)
async def adddoggo(self, ctx, url: str): async def adddoggo(self, ctx, url: str):
"""Saves a URL as a image to add for the doggo command""" """Saves a URL as an image to add for the doggo command"""
os.chdir('/home/phxntx5/public_html/Bonfire/images') os.chdir('/home/phxntx5/public_html/Bonfire/images')
local_path = 'doggo{}.jpg'.format(len(glob.glob('doggo*'))) local_path = 'doggo{}.jpg'.format(len(glob.glob('doggo*')))
urllib.request.urlretrieve(url,local_path) urllib.request.urlretrieve(url,local_path)

View file

@ -90,6 +90,7 @@ class Music:
pass pass
@commands.command(no_pm=True) @commands.command(no_pm=True)
@checks.customPermsOrRole("none")
async def join(self, *, channel: discord.Channel): async def join(self, *, channel: discord.Channel):
"""Joins a voice channel.""" """Joins a voice channel."""
try: try:
@ -105,6 +106,7 @@ class Music:
await self.bot.say('Ready to play audio in ' + channel.name) await self.bot.say('Ready to play audio in ' + channel.name)
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def summon(self, ctx): async def summon(self, ctx):
"""Summons the bot to join your voice channel.""" """Summons the bot to join your voice channel."""
summoned_channel = ctx.message.author.voice_channel summoned_channel = ctx.message.author.voice_channel
@ -120,6 +122,7 @@ class Music:
return True return True
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def play(self, ctx, *, song: str): async def play(self, ctx, *, song: str):
"""Plays a song. """Plays a song.
If there is a song currently in the queue, then it is If there is a song currently in the queue, then it is
@ -195,12 +198,14 @@ class Music:
pass pass
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def queuelength(self, ctx): async def queuelength(self, ctx):
"""Prints the length of the queue""" """Prints the length of the queue"""
await self.bot.say("There are a total of {} songs in the queue" await self.bot.say("There are a total of {} songs in the queue"
.format(str(self.get_voice_state(ctx.message.server).songs.qsize()))) .format(str(self.get_voice_state(ctx.message.server).songs.qsize())))
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def skip(self, ctx): async def skip(self, ctx):
"""Vote to skip a song. The song requester can automatically skip. """Vote to skip a song. The song requester can automatically skip.
3 skip votes are needed for the song to be skipped. 3 skip votes are needed for the song to be skipped.
@ -239,6 +244,7 @@ class Music:
await self.bot.say('Song has just been skipped.') await self.bot.say('Song has just been skipped.')
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def playing(self, ctx): async def playing(self, ctx):
"""Shows info about the currently played song.""" """Shows info about the currently played song."""

View file

@ -11,6 +11,7 @@ class Stats:
self.bot = bot self.bot = bot
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def mostboops(self, ctx): async def mostboops(self, ctx):
"""Shows the person you have 'booped' the most, as well as how many times""" """Shows the person you have 'booped' the most, as well as how many times"""
try: try:
@ -31,6 +32,7 @@ class Stats:
await self.bot.say(fmt.format(type(e).__name__, e)) await self.bot.say(fmt.format(type(e).__name__, e))
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def listboops(self, ctx): async def listboops(self, ctx):
try: try:
"""Lists all the users you have booped and the amount of times""" """Lists all the users you have booped and the amount of times"""
@ -55,6 +57,7 @@ class Stats:
await self.bot.say("You have not booped anyone {} Why the heck not...?".format(ctx.message.author.mention)) await self.bot.say("You have not booped anyone {} Why the heck not...?".format(ctx.message.author.mention))
@commands.command(pass_context=True, no_pm=True) @commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def mostwins(self, ctx): async def mostwins(self, ctx):
"""Prints a 'leaderboard' of everyone in the server's battling record""" """Prints a 'leaderboard' of everyone in the server's battling record"""
try: try:

View file

@ -50,6 +50,7 @@ class Twitch:
await asyncio.sleep(30) await asyncio.sleep(30)
@commands.group(no_pm=True, invoke_without_command=True) @commands.group(no_pm=True, invoke_without_command=True)
@checks.customPermsOrRole("none")
async def twitch(self, *, member: discord.Member=None): async def twitch(self, *, member: discord.Member=None):
"""Use this command to check the twitch info of a user""" """Use this command to check the twitch info of a user"""
if member is not None: if member is not None:
@ -73,6 +74,7 @@ class Twitch:
config.closeConnection() config.closeConnection()
@twitch.command(name='add', pass_context=True, no_pm=True) @twitch.command(name='add', pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def add_twitch_url(self, ctx, url: str): async def add_twitch_url(self, ctx, url: str):
"""Saves your user's twitch URL""" """Saves your user's twitch URL"""
try: try:
@ -103,6 +105,7 @@ class Twitch:
config.closeConnection() config.closeConnection()
@twitch.command(name='remove', aliases=['delete'], pass_context=True, no_pm=True) @twitch.command(name='remove', aliases=['delete'], pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def remove_twitch_url(self, ctx): async def remove_twitch_url(self, ctx):
"""Removes your twitch URL""" """Removes your twitch URL"""
cursor = config.getCursor() cursor = config.getCursor()
@ -120,11 +123,13 @@ class Twitch:
config.closeConnection() config.closeConnection()
@twitch.group(pass_context=True, no_pm=True, invoke_without_command=True) @twitch.group(pass_context=True, no_pm=True, invoke_without_command=True)
@checks.customPermsOrRole("none")
async def notify(self, ctx): async def notify(self, ctx):
"""This can be used to turn notifications on or off""" """This can be used to turn notifications on or off"""
pass pass
@notify.command(name='on', aliases=['start,yes'], pass_context=True, no_pm=True) @notify.command(name='on', aliases=['start,yes'], pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def notify_on(self, ctx): async def notify_on(self, ctx):
"""Turns twitch notifications on""" """Turns twitch notifications on"""
cursor = config.getCursor() cursor = config.getCursor()
@ -150,6 +155,7 @@ class Twitch:
return return
@notify.command(name='off', aliases=['stop,no'], pass_context=True, no_pm=True) @notify.command(name='off', aliases=['stop,no'], pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def notify_off(self, ctx): async def notify_off(self, ctx):
"""Turns twitch notifications off""" """Turns twitch notifications off"""
cursor = config.getCursor() cursor = config.getCursor()