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

View file

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

View file

@ -22,6 +22,7 @@ class Overwatch:
pass
@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=""):
"""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
@ -64,6 +65,7 @@ class Overwatch:
await self.bot.say("{} is not an actual hero!".format(hero.title()))
@ow.command(pass_context=True, name="add", no_pm=True)
@checks.customPermsOrRole("none")
async def add(self, ctx, bt: str):
"""Saves your battletag for looking up information"""
bt = bt.replace("#", "-")
@ -88,6 +90,7 @@ class Overwatch:
config.closeConnection()
@ow.command(pass_context=True, name="delete", aliases=['remove'], no_pm=True)
@checks.customPermsOrRole("none")
async def delete(self, ctx):
"""Removes your battletag from the records"""
cursor = config.getCursor()

View file

@ -35,7 +35,7 @@ class Owner:
@commands.command(pass_context=True)
@commands.check(checks.isOwner)
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')
local_path = 'doggo{}.jpg'.format(len(glob.glob('doggo*')))
urllib.request.urlretrieve(url,local_path)

View file

@ -90,6 +90,7 @@ class Music:
pass
@commands.command(no_pm=True)
@checks.customPermsOrRole("none")
async def join(self, *, channel: discord.Channel):
"""Joins a voice channel."""
try:
@ -105,6 +106,7 @@ class Music:
await self.bot.say('Ready to play audio in ' + channel.name)
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def summon(self, ctx):
"""Summons the bot to join your voice channel."""
summoned_channel = ctx.message.author.voice_channel
@ -120,6 +122,7 @@ class Music:
return True
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def play(self, ctx, *, song: str):
"""Plays a song.
If there is a song currently in the queue, then it is
@ -195,12 +198,14 @@ class Music:
pass
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def queuelength(self, ctx):
"""Prints the length of 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())))
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def skip(self, ctx):
"""Vote to skip a song. The song requester can automatically skip.
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.')
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def playing(self, ctx):
"""Shows info about the currently played song."""

View file

@ -11,6 +11,7 @@ class Stats:
self.bot = bot
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def mostboops(self, ctx):
"""Shows the person you have 'booped' the most, as well as how many times"""
try:
@ -31,6 +32,7 @@ class Stats:
await self.bot.say(fmt.format(type(e).__name__, e))
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def listboops(self, ctx):
try:
"""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))
@commands.command(pass_context=True, no_pm=True)
@checks.customPermsOrRole("none")
async def mostwins(self, ctx):
"""Prints a 'leaderboard' of everyone in the server's battling record"""
try:

View file

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