diff options
-rw-r--r-- | bot/__init__.py | 2 | ||||
-rw-r--r-- | bot/exts/christmas/advent_of_code/_cog.py | 18 | ||||
-rw-r--r-- | bot/exts/christmas/hanukkah_embed.py | 34 | ||||
-rw-r--r-- | bot/exts/evergreen/cheatsheet.py | 20 | ||||
-rw-r--r-- | bot/exts/evergreen/connect_four.py | 6 | ||||
-rw-r--r-- | bot/exts/evergreen/game.py | 15 | ||||
-rw-r--r-- | bot/exts/evergreen/pythonfacts.py | 14 | ||||
-rw-r--r-- | bot/exts/evergreen/snakes/_snakes_cog.py | 26 | ||||
-rw-r--r-- | bot/exts/evergreen/snakes/_utils.py | 7 |
9 files changed, 92 insertions, 50 deletions
diff --git a/bot/__init__.py b/bot/__init__.py index 669f9f5d..e5ed9d92 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -69,7 +69,7 @@ logging.basicConfig( level=logging.TRACE if Client.debug else logging.DEBUG, handlers=[console_handler, file_handler], ) -logging.getLogger().info('Logging initialization complete') +logging.getLogger().info("Logging initialization complete") # On Windows, the selector event loop is required for aiodns. diff --git a/bot/exts/christmas/advent_of_code/_cog.py b/bot/exts/christmas/advent_of_code/_cog.py index da1cf28d..863d2a21 100644 --- a/bot/exts/christmas/advent_of_code/_cog.py +++ b/bot/exts/christmas/advent_of_code/_cog.py @@ -72,11 +72,15 @@ class AdventOfCode(commands.Cog): if role not in ctx.author.roles: await ctx.author.add_roles(role) - await ctx.send("Okay! You have been __subscribed__ to notifications about new Advent of Code tasks. " - f"You can run `{unsubscribe_command}` to disable them again for you.") + await ctx.send( + "Okay! You have been __subscribed__ to notifications about new Advent of Code tasks. " + f"You can run `{unsubscribe_command}` to disable them again for you." + ) else: - await ctx.send("Hey, you already are receiving notifications about new Advent of Code tasks. " - f"If you don't want them any more, run `{unsubscribe_command}` instead.") + await ctx.send( + "Hey, you already are receiving notifications about new Advent of Code tasks. " + f"If you don't want them any more, run `{unsubscribe_command}` instead." + ) @in_month(Month.DECEMBER) @adventofcode_group.command(name="unsubscribe", aliases=("unsub",), brief="Notifications for new days") @@ -110,8 +114,10 @@ class AdventOfCode(commands.Cog): else: delta_str = f"{delta.days} days" - await ctx.send(f"The Advent of Code event is not currently running. " - f"The next event will start in {delta_str}.") + await ctx.send( + f"The Advent of Code event is not currently running. " + f"The next event will start in {delta_str}." + ) return tomorrow, time_left = _helpers.time_left_to_est_midnight() diff --git a/bot/exts/christmas/hanukkah_embed.py b/bot/exts/christmas/hanukkah_embed.py index 214044b8..af5cfccf 100644 --- a/bot/exts/christmas/hanukkah_embed.py +++ b/bot/exts/christmas/hanukkah_embed.py @@ -17,8 +17,10 @@ class HanukkahEmbed(commands.Cog): def __init__(self, bot: Bot): self.bot = bot - self.url = ("https://www.hebcal.com/hebcal/?v=1&cfg=json&maj=on&min=on&mod=on&nx=on&" - "year=now&month=x&ss=on&mf=on&c=on&geo=geoname&geonameid=3448439&m=50&s=on") + self.url = ( + "https://www.hebcal.com/hebcal/?v=1&cfg=json&maj=on&min=on&mod=on&nx=on&" + "year=now&month=x&ss=on&mf=on&c=on&geo=geoname&geonameid=3448439&m=50&s=on" + ) self.hanukkah_days = [] self.hanukkah_months = [] self.hanukkah_years = [] @@ -64,13 +66,17 @@ class HanukkahEmbed(commands.Cog): hours = now.hour + 4 # using only hours hanukkah_start_hour = 18 if hours < hanukkah_start_hour: - embed.description = (f"Hanukkah hasnt started yet, " - f"it will start in about {hanukkah_start_hour - hours} hour/s.") + embed.description = ( + f"Hanukkah hasnt started yet, " + f"it will start in about {hanukkah_start_hour - hours} hour/s." + ) await ctx.send(embed=embed) return elif hours > hanukkah_start_hour: - embed.description = (f"It is the starting day of Hanukkah ! " - f"Its been {hours - hanukkah_start_hour} hours hanukkah started !") + embed.description = ( + f"It is the starting day of Hanukkah ! " + f"Its been {hours - hanukkah_start_hour} hours hanukkah started !" + ) await ctx.send(embed=embed) return festival_day = self.hanukkah_days.index(day) @@ -87,18 +93,22 @@ class HanukkahEmbed(commands.Cog): message = "" for _ in range(1, festival_day + 1): message += ":menorah:" - embed.description = f"It is the {festival_day}{suffix} day of Hanukkah ! \n {message}" + embed.description = f"It is the {festival_day}{suffix} day of Hanukkah!\n{message}" await ctx.send(embed=embed) else: if today < hanukkah_start: festival_starting_month = hanukkah_start.strftime("%B") - embed.description = (f"Hanukkah has not started yet. " - f"Hanukkah will start at sundown on {hanukkah_start_day}th " - f"of {festival_starting_month}.") + embed.description = ( + f"Hanukkah has not started yet. " + f"Hanukkah will start at sundown on {hanukkah_start_day}th " + f"of {festival_starting_month}." + ) else: festival_end_month = hanukkah_end.strftime("%B") - embed.description = (f"Looks like you missed Hanukkah !" - f"Hanukkah ended on {hanukkah_end_day}th of {festival_end_month}.") + embed.description = ( + f"Looks like you missed Hanukkah !" + f"Hanukkah ended on {hanukkah_end_day}th of {festival_end_month}." + ) await ctx.send(embed=embed) diff --git a/bot/exts/evergreen/cheatsheet.py b/bot/exts/evergreen/cheatsheet.py index 86fae167..7ee34b1d 100644 --- a/bot/exts/evergreen/cheatsheet.py +++ b/bot/exts/evergreen/cheatsheet.py @@ -12,7 +12,7 @@ from bot.bot import Bot from bot.constants import Categories, Channels, Colours, ERROR_REPLIES from bot.utils.decorators import whitelist_override -ERROR_MESSAGE = f""" +ERROR_MESSAGE = f"""\ Unknown cheat sheet. Please try to reformulate your query. **Examples**: @@ -61,14 +61,18 @@ class CheatSheet(commands.Cog): body_space = min(1986 - len(url), 1000) if len(body_text) > body_space: - description = (f"**Result Of cht.sh**\n" - f"```python\n{body_text[:body_space]}\n" - f"... (truncated - too many lines)```\n" - f"Full results: {url} ") + description = ( + f"**Result Of cht.sh**\n" + f"```python\n{body_text[:body_space]}\n" + f"... (truncated - too many lines)```\n" + f"Full results: {url} " + ) else: - description = (f"**Result Of cht.sh**\n" - f"```python\n{body_text}```\n" - f"{url}") + description = ( + f"**Result Of cht.sh**\n" + f"```python\n{body_text}```\n" + f"{url}" + ) return False, description @commands.command( diff --git a/bot/exts/evergreen/connect_four.py b/bot/exts/evergreen/connect_four.py index 929a15d8..dc365a70 100644 --- a/bot/exts/evergreen/connect_four.py +++ b/bot/exts/evergreen/connect_four.py @@ -277,8 +277,10 @@ class ConnectFour(commands.Cog): return False if not self.min_board_size <= board_size <= self.max_board_size: - await ctx.send(f"{board_size} is not a valid board size. A valid board size is " - f"between `{self.min_board_size}` and `{self.max_board_size}`.") + await ctx.send( + f"{board_size} is not a valid board size. A valid board size is " + f"between `{self.min_board_size}` and `{self.max_board_size}`." + ) return False return True diff --git a/bot/exts/evergreen/game.py b/bot/exts/evergreen/game.py index 4da33259..6f01d81c 100644 --- a/bot/exts/evergreen/game.py +++ b/bot/exts/evergreen/game.py @@ -335,13 +335,14 @@ class Games(Cog): return await ctx.send("Successfully refreshed genres.") - async def get_games_list(self, - amount: int, - genre: Optional[str] = None, - sort: Optional[str] = None, - additional_body: str = "", - offset: int = 0 - ) -> List[Dict[str, Any]]: + async def get_games_list( + self, + amount: int, + genre: Optional[str] = None, + sort: Optional[str] = None, + additional_body: str = "", + offset: int = 0 + ) -> List[Dict[str, Any]]: """ Get list of games from IGDB API by parameters that is provided. diff --git a/bot/exts/evergreen/pythonfacts.py b/bot/exts/evergreen/pythonfacts.py index c0086c20..e162c9bd 100644 --- a/bot/exts/evergreen/pythonfacts.py +++ b/bot/exts/evergreen/pythonfacts.py @@ -18,11 +18,15 @@ class PythonFacts(commands.Cog): @commands.command(name="pythonfact", aliases=["pyfact"]) async def get_python_fact(self, ctx: commands.Context) -> None: """Sends a Random fun fact about Python.""" - embed = discord.Embed(title="Python Facts", - description=next(FACTS), - colour=next(COLORS)) - embed.add_field(name="Suggestions", - value="Suggest more facts [here!](https://github.com/python-discord/meta/discussions/93)") + embed = discord.Embed( + title="Python Facts", + description=next(FACTS), + colour=next(COLORS) + ) + embed.add_field( + name="Suggestions", + value="Suggest more facts [here!](https://github.com/python-discord/meta/discussions/93)" + ) await ctx.send(embed=embed) diff --git a/bot/exts/evergreen/snakes/_snakes_cog.py b/bot/exts/evergreen/snakes/_snakes_cog.py index 62795aef..6278c883 100644 --- a/bot/exts/evergreen/snakes/_snakes_cog.py +++ b/bot/exts/evergreen/snakes/_snakes_cog.py @@ -497,9 +497,11 @@ class Snakes(Cog): for i in range(0, 10): page_guess_list.append(f"{HOLE_EMOJI} {HOLE_EMOJI} {HOLE_EMOJI} {HOLE_EMOJI}") page_result_list.append(f"{CROSS_EMOJI} {CROSS_EMOJI} {CROSS_EMOJI} {CROSS_EMOJI}") - board.append(f"`{i+1:02d}` " - f"{page_guess_list[i]} - " - f"{page_result_list[i]}") + board.append( + f"`{i+1:02d}` " + f"{page_guess_list[i]} - " + f"{page_result_list[i]}" + ) board.append(EMPTY_UNICODE) antidote_embed.add_field(name="10 guesses remaining", value="\n".join(board)) board_id = await ctx.send(embed=antidote_embed) # Display board @@ -667,8 +669,14 @@ class Snakes(Cog): ) emoji = "https://emojipedia-us.s3.amazonaws.com/thumbs/60/google/3/snake_1f40d.png" - image = next((url for url in data["image_list"] - if url.endswith(self.valid_image_extensions)), emoji) + + _iter = ( + url + for url in data["image_list"] + if url.endswith(self.valid_image_extensions) + ) + image = next(_iter, emoji) + embed.set_image(url=image) await ctx.send(embed=embed) @@ -693,8 +701,12 @@ class Snakes(Cog): data = await self._get_snek(snake) - image = next((url for url in data["image_list"] - if url.endswith(self.valid_image_extensions)), None) + _iter = ( + url + for url in data["image_list"] + if url.endswith(self.valid_image_extensions) + ) + image = next(_iter, None) embed = Embed( title="Which of the following is the snake in the image?", diff --git a/bot/exts/evergreen/snakes/_utils.py b/bot/exts/evergreen/snakes/_utils.py index d58ee279..998c13a9 100644 --- a/bot/exts/evergreen/snakes/_utils.py +++ b/bot/exts/evergreen/snakes/_utils.py @@ -191,8 +191,11 @@ class PerlinNoiseFactory(object): def get_plain_noise(self, *point) -> float: """Get plain noise for a single point, without taking into account either octaves or tiling.""" if len(point) != self.dimension: - raise ValueError("Expected {0} values, got {1}".format( - self.dimension, len(point))) + raise ValueError( + "Expected {0} values, got {1}".format( + self.dimension, len(point) + ) + ) # Build a list of the (min, max) bounds in each dimension grid_coords = [] |