1
0
Fork 0
mirror of synced 2024-05-29 00:39:39 +12:00

Pep8 changes

This commit is contained in:
phxntxm 2016-11-29 02:05:22 -06:00
parent 354a482160
commit bf692e4c74
8 changed files with 43 additions and 36 deletions

View file

@ -43,14 +43,16 @@ class Core:
@commands.command(pass_context=True)
@checks.custom_perms(send_messages=True)
async def help(self, ctx, *, message: str = []):
async def help(self, ctx, *, message=None):
"""This command is used to provide a link to the help URL"""
if message is None:
message = []
cmd = self.find_command(message)
if cmd is None:
fmt = "This URL can be used to view information about all commands: <{}>. " \
"Run help on a command specifically in order to get information on that command.".format(config.help_url)
fmt = "This URL can be used to view information about all commands: <{}>. Run help on a command " \
"specifically in order to get information on that command.".format(config.help_url)
await self.bot.say(fmt)
else:
description = cmd.help
@ -158,7 +160,6 @@ class Core:
# fmt is a dictionary so we can set the key to it's output, then print both
# The only real use of doing it this way is easier editing if the info
# in this command is changed
fmt = {}
bot_data = await config.get_content('bot_data')
total_data = {'member_count': 0,
@ -169,8 +170,8 @@ class Core:
# Create the original embed object
opts = {'title': 'Dev Server',
'description': 'Join the server above for any questions/suggestions about me.',
'url': config.dev_server}
'description': 'Join the server above for any questions/suggestions about me.',
'url': config.dev_server}
embed = discord.Embed(**opts)
# Add the normal values

View file

@ -8,8 +8,9 @@ from discord.ext import commands
from .utils import config
from .utils import checks
log = logging.getLogger()
class Deviantart:
def __init__(self, bot):
self.base_url = "https://www.deviantart.com/api/v1/oauth2/gallery/all"
@ -90,9 +91,9 @@ class Deviantart:
if last_updated_id is not None:
fmt = "There has been a new post by an artist you are subscribed to!\n\n" \
"**Title:** {}\n**User:** {}\n**URL:** {}".format(
result['title'],
result['author']['username'],
result['url'])
result['title'],
result['author']['username'],
result['url'])
await self.bot.send_message(user, fmt)
# Now we can update the user's last updated for this DA
# We want to do this whether or not our last if statement was met

View file

@ -3,6 +3,7 @@ from .utils import checks
import discord
from discord.ext import commands
class Music:
"""
This cog is simply created in order to add all commands in the playlist cog
@ -11,6 +12,7 @@ class Music:
And still use commands that require another command to be passed
from the instance that hasn't loaded the playlist cog
"""
def __init__(self, bot):
self.bot = bot
@ -153,5 +155,6 @@ class Music:
RESULT: Information about the song that's currently playing!"""
pass
def setup(bot):
bot.add_cog(Music(bot))

View file

@ -26,7 +26,8 @@ battle_outcomes = \
"{0} realized it was high noon, {1} never even saw it coming.",
"{1} spontaneously combusted...lol rip",
"after many turns {0} summons exodia and {1} is sent to the shadow realm",
"{0} and {1} sit down for an intense game of chess, in the heat of the moment {0} forgot they were playing a game and summoned a real knight",
"{0} and {1} sit down for an intense game of chess, in the heat of the moment {0} forgot they were playing a "
"game and summoned a real knight",
"{0} challenges {1} to rock paper scissors, unfortunately for {1}, {0} chose scissors and stabbed them",
"{0} goes back in time and becomes {1}'s best friend, winning without ever throwing a punch",
"{1} trips down some stairs on their way to the battle with {0}",
@ -38,7 +39,8 @@ battle_outcomes = \
"{0} brought an army to a fist fight, {1} never saw their opponent once",
"{0} used multiple simultaneous devestating defensive deep strikes to overwhelm {1}",
"{0} and {1} engage in a dance off; {0} wiped the floor with {1}",
"{1} tried to hide in the sand to catch {0} off guard, unfortunately looks like a Giant Antlion had the same idea for him",
"{1} tried to hide in the sand to catch {0} off guard, unfortunately looks like a Giant Antlion had the same "
"idea for him",
"{1} was busy playing trash videogames the night before the fight and collapsed before {0}",
"{0} threw a sick meme and {1} totally got PRANK'D",
"{0} and {1} go on a skiing trip together, turns out {1} forgot how to pizza french-fry",

View file

@ -39,9 +39,9 @@ class Mod:
return cmd
@commands.command(pass_context=True, no_pm=True)
@commands.command(no_pm=True)
@checks.custom_perms(kick_members=True)
async def kick(self, ctx, member: discord.Member):
async def kick(self, member: discord.Member):
"""Used to kick a member from this server
EXAMPLE: !kick @Member
@ -97,17 +97,17 @@ class Mod:
member = converter.convert()
except commands.converter.BadArgument:
await self.bot.say(
"{} does not appear to be a valid member. If this member is not in this server, please provide their ID".format(
member))
'{} does not appear to be a valid member. If this member is not in this server, please provide '
'their ID'.format(member))
return
# Now lets try actually banning the member we've been given
try:
await self.bot.ban(member)
await self.bot.say("\N{OK HAND SIGN}")
except discord.HTTPException:
await self.bot.say("Sorry, I failed to ban that user!")
except discord.Forbidden:
await self.bot.say("But I can't, muh permissions >:c")
except discord.HTTPException:
await self.bot.say("Sorry, I failed to ban that user!")
@commands.command(pass_context=True, no_pm=True)
@checks.custom_perms(kick_members=True)
@ -199,8 +199,8 @@ class Mod:
"""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
EXAMPLE: !perms help
RESULT: Hopefully a result saying you just need send_messages permissions; otherwise lol this server's admin doesn't like me"""
EXAMPLE: !perms help RESULT: Hopefully a result saying you just need send_messages permissions; otherwise lol
this server's admin doesn't like me """
if command is None:
await self.bot.say(
"Valid permissions are: ```\n{}```".format("\n".join("{}".format(i) for i in valid_perms)))

View file

@ -11,6 +11,7 @@ import aiohttp
base_url = 'https://osu.ppy.sh/api/'
MAX_RETRIES = 5
class Osu:
def __init__(self, bot):
self.bot = bot
@ -81,19 +82,19 @@ class Osu:
# A list of the possible values we'll receive, that we want to display
wanted_info = ['username', 'maxcombo', 'count300', 'count100', 'count50', 'countmiss',
'perfect', 'enabled_mods', 'date', 'rank' 'pp', 'beatmap_title', 'beatmap_version',
'max_combo', 'artist', 'difficulty']
'perfect', 'enabled_mods', 'date', 'rank' 'pp', 'beatmap_title', 'beatmap_version',
'max_combo', 'artist', 'difficulty']
# A couple of these aren't the best names to display, so setup a map to change these just a little bit
key_map = {'maxcombo': 'combo',
'count300': '300 hits',
'count100': '100 hits',
'count50': '50 hits',
'countmiss': 'misses',
'perfect': 'got_max_combo'}
'count300': '300 hits',
'count100': '100 hits',
'count50': '50 hits',
'countmiss': 'misses',
'perfect': 'got_max_combo'}
params = {'u': user,
'limit': 100}
'limit': 100}
# The endpoint that we're accessing to get this informatin
endpoint = 'get_user_best'
data = await self._request(params, endpoint)
@ -149,13 +150,13 @@ class Osu:
await self.bot.say("Looking up your Osu information...")
# A list of the possible values we'll receive, that we want to display
wanted_info = ['username', 'playcount', 'ranked_score', 'pp_rank', 'level', 'pp_country_rank',
'accuracy', 'country', 'pp_country_rank', 'count_rank_s', 'count_rank_a']
'accuracy', 'country', 'pp_country_rank', 'count_rank_s', 'count_rank_a']
# A couple of these aren't the best names to display, so setup a map to change these just a little bit
key_map = {'playcount': 'play_count',
'count_rank_ss': 'total_SS_ranks',
'count_rank_s': 'total_s_ranks',
'count_rank_a': 'total_a_ranks'}
'count_rank_ss': 'total_SS_ranks',
'count_rank_s': 'total_s_ranks',
'count_rank_a': 'total_a_ranks'}
# The paramaters that we'll send to osu to get the information needed
params = {'u': user}
@ -186,5 +187,6 @@ class Osu:
_fmt = "\n".join("{}: {}".format(k, r) for k, r in fmt.items())
await self.bot.say("```\n{}```".format(_fmt))
def setup(bot):
bot.add_cog(Osu(bot))

View file

@ -57,7 +57,7 @@ class VoiceEntry:
def length(self):
if self.player.duration:
return self.player.duration
@property
def progress(self):
if self.start_time:
@ -242,8 +242,6 @@ class Music:
fmt = "Current song progress: {0[0]}m {0[1]}s/{1[0]}m {1[1]}s".format(progress, length)
await self.bot.say(fmt)
@commands.command(pass_context=True, no_pm=True)
@checks.custom_perms(send_messages=True)
async def join(self, ctx, *, channel: discord.Channel):

View file

@ -11,9 +11,9 @@ import rethinkdb as r
import traceback
import logging
log = logging.getLogger()
class Twitch:
"""Class for some twitch integration
You can add or remove your twitch stream for your user