diff --git a/cogs/core.py b/cogs/core.py index 9bc7236..f799a14 100644 --- a/cogs/core.py +++ b/cogs/core.py @@ -21,7 +21,7 @@ class Core: await self.bot.say((await self.bot.application_info()).id) @commands.command() - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def calendar(self, 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""" @@ -52,7 +52,7 @@ class Core: await self.bot.say("```{}```".format(cal)) @commands.command() - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def addbot(self): """Provides a link that you can use to add me to a server""" perms = discord.Permissions.none() @@ -69,7 +69,7 @@ class Core: .format(discord.utils.oauth_url('183748889814237186', perms))) @commands.command(pass_context=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def doggo(self, ctx): """Use this to print a random doggo image. Doggo is love, doggo is life.""" @@ -79,7 +79,7 @@ class Core: await self.bot.upload(f) @commands.command() - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def joke(self): """Prints a random riddle""" fortuneCommand = "/usr/bin/fortune riddles" @@ -88,7 +88,7 @@ class Core: @commands.command(pass_context=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def roll(self, ctx, notation: str="d6"): """Rolls a die based on the notation given Format should be #d#""" diff --git a/cogs/interaction.py b/cogs/interaction.py index 685a32f..7c5e261 100644 --- a/cogs/interaction.py +++ b/cogs/interaction.py @@ -18,10 +18,10 @@ def userBattling(ctx): battling = config.getContent('battling') if battling is None: return False - if ctx.message.author.id in battling or ctx.message.author.id in battling.values(): + if ctx.message.author.id in battling.values() or ctx.message.author.id in battling.keys(): return True if str(ctx.command) == 'battle': - return ctx.message.mentions[0].id in battling.values() + return ctx.message.mentions[0].id in battling.values() or ctx.message.mentions[0].id in battling.keys(): return False @@ -75,7 +75,7 @@ class Interaction: self.bot = bot @commands.group(pass_context=True, no_pm=True,invoke_without_command=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def battle(self, ctx, player2: discord.Member): """Challenges the mentioned user to a battle""" if len(ctx.message.mentions) == 0: @@ -105,7 +105,7 @@ class Interaction: @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def accept(self, ctx): """Accepts the battle challenge""" if not userBattling(ctx): @@ -134,7 +134,7 @@ class Interaction: battlingOff(ctx.message.author.id) @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def decline(self, ctx): """Declines the battle challenge""" if not userBattling(ctx): @@ -156,7 +156,7 @@ class Interaction: @commands.command(pass_context=True, no_pm=True) @commands.cooldown(1,180,BucketType.user) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def boop(self, ctx, boopee: discord.Member): """Boops the mentioned person""" booper = ctx.message.author diff --git a/cogs/links.py b/cogs/links.py index 027e951..a0f8886 100644 --- a/cogs/links.py +++ b/cogs/links.py @@ -13,7 +13,7 @@ class Links: self.bot = bot @commands.command() - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def urban(self, *msg: str): """Pulls the top urbandictionary.com definition for a term""" url = "http://api.urbandictionary.com/v0/define?term={}".format('+'.join(msg)) @@ -31,7 +31,7 @@ class Links: await self.bot.say('```Error: Definition is too long for me to send```') @commands.command(pass_context=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) 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: @@ -64,7 +64,7 @@ class Links: @commands.command(pass_context=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) 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.' diff --git a/cogs/mod.py b/cogs/mod.py index ac8e2a7..d6ca482 100644 --- a/cogs/mod.py +++ b/cogs/mod.py @@ -20,7 +20,7 @@ class Mod: await self.bot.say('Invalid subcommand passed: {0.subcommand_passed}'.format(ctx)) @nsfw.command(name="add", pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def nsfw_add(self, ctx): """Registers this channel as a 'nsfw' channel""" nsfw_channels = config.getContent('nsfw_channels') @@ -32,7 +32,7 @@ class Mod: await self.bot.say("This channel has just been registered as 'nsfw'! Have fun you naughties ;)") @nsfw.command(name="remove", aliases=["delete"], pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def nsfw_remove(self, ctx): """Removes this channel as a 'nsfw' channel""" nsfw_channels = config.getContent('nsfw_channels') @@ -44,21 +44,21 @@ class Mod: await self.bot.say("This channel has just been unregistered as a nsfw channel") @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("manage_server") + @checks.customPermsOrRole(manage_server=True) async def leave(self, ctx): """Forces the bot to leave the server""" await self.bot.say('Why must I leave? Hopefully I can come back :c') await self.bot.leave_server(ctx.message.server) @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def say(self, ctx, *, msg: str): """Tells the bot to repeat what you say""" await self.bot.say(msg) await self.bot.delete_message(ctx.message) @commands.group(pass_context=True, invoke_without_command=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def perms(self, ctx, *, command: str): """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""" diff --git a/cogs/overwatch.py b/cogs/overwatch.py index fd777ee..80aec4c 100644 --- a/cogs/overwatch.py +++ b/cogs/overwatch.py @@ -28,7 +28,7 @@ class Overwatch: pass @ow.command(name="stats", pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) 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""" @@ -74,7 +74,7 @@ class Overwatch: .format(user.name, hero.title(), fmt.title().replace("_", " "))) @ow.command(pass_context=True, name="add", no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def add(self, ctx, bt: str): """Saves your battletag for looking up information""" bt = bt.replace("#", "-") @@ -96,7 +96,7 @@ class Overwatch: await self.bot.say("I was unable to save this data") @ow.command(pass_context=True, name="delete", aliases=['remove'], no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def delete(self, ctx): """Removes your battletag from the records""" result = config.getContent('overwatch') diff --git a/cogs/playlist.py b/cogs/playlist.py index 1143b36..1a1ae12 100644 --- a/cogs/playlist.py +++ b/cogs/playlist.py @@ -97,7 +97,7 @@ class Music: pass @commands.command(no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def join(self, *, channel: discord.Channel): """Joins a voice channel.""" try: @@ -113,7 +113,7 @@ class Music: await self.bot.say('Ready to play audio in ' + channel.name) @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def summon(self, ctx): """Summons the bot to join your voice channel.""" summoned_channel = ctx.message.author.voice_channel @@ -129,7 +129,7 @@ class Music: return True @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def play(self, ctx, *, song: str): """Plays a song. If there is a song currently in the queue, then it is @@ -156,7 +156,7 @@ class Music: await state.songs.put(entry) @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def volume(self, ctx, value: int): """Sets the volume of the currently playing song.""" @@ -167,7 +167,7 @@ class Music: await self.bot.say('Set the volume to {:.0%}'.format(player.volume)) @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def pause(self, ctx): """Pauses the currently played song.""" state = self.get_voice_state(ctx.message.server) @@ -176,7 +176,7 @@ class Music: player.pause() @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def resume(self, ctx): """Resumes the currently played song.""" state = self.get_voice_state(ctx.message.server) @@ -185,7 +185,7 @@ class Music: player.resume() @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def stop(self, ctx): """Stops playing audio and leaves the voice channel. This also clears the queue. @@ -205,14 +205,14 @@ class Music: pass @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) 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("send_messages") + @checks.customPermsOrRole(send_messages=True) 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,7 +239,7 @@ class Music: await self.bot.say('You have already voted to skip this song.') @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def modskip(self, ctx): """Forces a song skip, can only be used by a moderator""" state = self.get_voice_state(ctx.message.server) @@ -251,7 +251,7 @@ class Music: await self.bot.say('Song has just been skipped.') @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def playing(self, ctx): """Shows info about the currently played song.""" diff --git a/cogs/stats.py b/cogs/stats.py index 5f73687..1e057f0 100644 --- a/cogs/stats.py +++ b/cogs/stats.py @@ -13,7 +13,7 @@ class Stats: self.bot = bot @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def mostboops(self, ctx): """Shows the person you have 'booped' the most, as well as how many times""" boops = config.getContent('boops') @@ -33,7 +33,7 @@ class Stats: ctx.message.author.mention, member.mention, most_boops)) @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def listboops(self, ctx): """Lists all the users you have booped and the amount of times""" members = ctx.message.server.members @@ -50,7 +50,7 @@ class Stats: await self.bot.say("You have booped:```{}```".format(output)) @commands.command(pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def leaderboard(self, ctx): """Prints a leaderboard of everyone in the server's battling record""" battles = config.getContent('battle_records') @@ -71,7 +71,7 @@ class Stats: @commands.command(pass_context=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def stats(self, ctx, member: discord.Member=None): """Prints the battling stats for you, or the user provided""" member = member or ctx.message.author diff --git a/cogs/tags.py b/cogs/tags.py index 77ae258..7100e06 100644 --- a/cogs/tags.py +++ b/cogs/tags.py @@ -9,7 +9,7 @@ class Tags: self.bot = bot @commands.command(pass_context=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def tags(self, ctx): """Prints all the custom tags that this server currently has""" tags = config.getContent('tags') @@ -17,7 +17,7 @@ class Tags: await self.bot.say('```{}```'.format(fmt)) @commands.group(pass_context=True, invoke_without_command=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def tag(self, ctx, *, tag: str): """This can be used to call custom tags The format to call a custom tag is !tag """ @@ -29,7 +29,7 @@ class Tags: await self.bot.say("{}".format(result[0]['result'])) @tag.command(name='add', aliases=['create', 'start'], pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def add_tag(self, ctx, *, result: str): """Use this to add a new tag that can be used in this server Format to add a tag is !tag add - """ @@ -54,7 +54,7 @@ class Tags: await self.bot.say("I was unable to save this data") @tag.command(name='delete', aliases=['remove', 'stop'], pass_context=True, no_pm=True) - @checks.customPermsOrRole("kick_members") + @checks.customPermsOrRole(kick_members=True) async def del_tag(self, ctx, *, tag: str): """Use this to remove a tag that from use for this server Format to delete a tag is !tag delete """ diff --git a/cogs/twitch.py b/cogs/twitch.py index cdbb662..648329c 100644 --- a/cogs/twitch.py +++ b/cogs/twitch.py @@ -52,7 +52,7 @@ class Twitch: await asyncio.sleep(30) @commands.group(no_pm=True, invoke_without_command=True, pass_context=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def twitch(self, ctx, *, member: discord.Member=None): """Use this command to check the twitch info of a user""" if member is None: @@ -78,7 +78,7 @@ class Twitch: await self.bot.say("```{}```".format(fmt)) @twitch.command(name='add', pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def add_twitch_url(self, ctx, url: str): """Saves your user's twitch URL""" try: @@ -107,7 +107,7 @@ class Twitch: await self.bot.say("I have just saved your twitch url {}".format(ctx.message.author.mention)) @twitch.command(name='remove', aliases=['delete'], pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def remove_twitch_url(self, ctx): """Removes your twitch URL""" twitch = config.getContent('twitch') @@ -121,13 +121,13 @@ class Twitch: ctx.message.author.mention)) @twitch.group(pass_context=True, no_pm=True, invoke_without_command=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) 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("send_messages") + @checks.customPermsOrRole(send_messages=True) async def notify_on(self, ctx): """Turns twitch notifications on""" twitch = config.getContent('twitch') @@ -146,7 +146,7 @@ class Twitch: ctx.message.author.mention)) @notify.command(name='off', aliases=['stop,no'], pass_context=True, no_pm=True) - @checks.customPermsOrRole("send_messages") + @checks.customPermsOrRole(send_messages=True) async def notify_off(self, ctx): """Turns twitch notifications off""" twitch = config.getContent('twitch')