diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 582244a..d073015 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,4 +20,3 @@ jobs: run: python main.py - name: Run tests run: pytest tests/ - \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ded5d64..be6a91c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 + rev: v6.0.0 hooks: - id: check-executables-have-shebangs - id: check-toml @@ -11,39 +11,39 @@ repos: - id: requirements-txt-fixer - repo: https://github.com/MarcoGorelli/auto-walrus - rev: v0.2.2 + rev: 0.4.1 hooks: - id: auto-walrus - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.270 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.15.9 hooks: - id: ruff - - repo: https://github.com/psf/black - rev: 23.3.0 + - repo: https://github.com/psf/black-pre-commit-mirror + rev: 26.3.1 hooks: - id: black - repo: https://github.com/codespell-project/codespell - rev: v2.2.4 + rev: v2.4.2 hooks: - id: codespell additional_dependencies: - tomli - repo: https://github.com/tox-dev/pyproject-fmt - rev: "0.11.2" + rev: "v2.21.0" hooks: - id: pyproject-fmt - repo: https://github.com/abravalheri/validate-pyproject - rev: v0.13 + rev: v0.25 hooks: - id: validate-pyproject - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.3.0 + rev: v1.20.0 hooks: - id: mypy args: diff --git a/cogs/crime.py b/cogs/crime.py index f10c3e2..60e3826 100644 --- a/cogs/crime.py +++ b/cogs/crime.py @@ -42,14 +42,12 @@ async def wanted_criminals(self, ctx: Context) -> None: {"[hair_colow:] " + json['hair'] if json['hair'] else ''} """ data = re.sub("\n{2,}", "\n", data).strip() - await ctx.em( - """```yaml + await ctx.em("""```yaml ++ -- wanted criminal {json['title']} -- ++ {data} - [real data curated from official FBI sources]```""" - ) + [real data curated from official FBI sources]```""") @commands.command(aliases=["jail"]) async def jailbase( @@ -96,14 +94,12 @@ async def police(self, ctx: Context) -> None: json = await resp.json() ", ".join(json[k]["name"] for k in range(0, len(json))) - await ctx.em( - """```yaml + await ctx.em("""```yaml ++ -- All police forces in england -- ++ {police} - [Factual information curated from official police data]```""" - ) + [Factual information curated from official police data]```""") @commands.command() async def coordinates(self, ctx: Context, *, poste_code=None) -> None: @@ -115,16 +111,14 @@ async def coordinates(self, ctx: Context, *, poste_code=None) -> None: if not json["data"][0]: return await ctx.em("Invalid location!") - await ctx.em( - """```yaml + await ctx.em("""```yaml ++ -- coordinates for {poste_code} -- ++ [Longitude:] {json['data'][0]['longitude']} [Latitude:] {json['data'][0]['latitude']} [Region:] {json['data'][0]['region']} [Country:] {json['data'][0]['country']}``` - """ - ) + """) @commands.command(aliases=["searches"]) async def stop_and_searches(self, ctx: Context, poste_code=None) -> None: diff --git a/cogs/docs/exts.py b/cogs/docs/exts.py index 44007c2..8b34d47 100644 --- a/cogs/docs/exts.py +++ b/cogs/docs/exts.py @@ -79,8 +79,8 @@ def parse_object_inv(self, stream, url): if not match: continue - (name, directive, prio, location, dispname) = match.groups() - (domain, _, subdirective) = directive.partition(":") + name, directive, prio, location, dispname = match.groups() + domain, _, subdirective = directive.partition(":") if directive == "py:module" and name in result: continue diff --git a/cogs/docs/fuzzy.py b/cogs/docs/fuzzy.py index e0add68..f8d211d 100644 --- a/cogs/docs/fuzzy.py +++ b/cogs/docs/fuzzy.py @@ -14,7 +14,7 @@ def quick_ratio(a, b): def partial_ratio(a, b): - (short, long) = (a, b) if len(a) <= len(b) else (b, a) + short, long = (a, b) if len(a) <= len(b) else (b, a) m = SequenceMatcher(None, short, long) blocks = m.get_matching_blocks() diff --git a/cogs/docs/menus.py b/cogs/docs/menus.py index e9d6db7..704eabd 100644 --- a/cogs/docs/menus.py +++ b/cogs/docs/menus.py @@ -578,7 +578,7 @@ async def _internal_loop(self): ) ), ] - (done, pending) = await asyncio.wait( + done, pending = await asyncio.wait( tasks, timeout=self.timeout, return_when=asyncio.FIRST_COMPLETED ) for task in pending: @@ -1068,7 +1068,7 @@ def __init__(self, entries, *, per_page): self.entries = entries self.per_page = per_page - (pages, left_over) = divmod(len(entries), per_page) + pages, left_over = divmod(len(entries), per_page) if left_over: pages += 1 diff --git a/cogs/docs/pagination.py b/cogs/docs/pagination.py index 204c30c..90de876 100644 --- a/cogs/docs/pagination.py +++ b/cogs/docs/pagination.py @@ -130,9 +130,10 @@ def fill_items(self) -> None: self.add_item(self.numbered_page) self.add_item(self.stop_pages) - async def _get_kwargs_from_page( - self, page: int - ) -> Dict[str, Any,]: + async def _get_kwargs_from_page(self, page: int) -> Dict[ + str, + Any, + ]: value = await disnake.utils.maybe_coroutine(self.source.format_page, self, page) if isinstance(value, dict): return value diff --git a/cogs/event.py b/cogs/event.py index bffc4d0..6ecf998 100644 --- a/cogs/event.py +++ b/cogs/event.py @@ -291,7 +291,7 @@ def check(e, u): return u == message.author and e.message.id == message.id try: - (emoji, user) = await self.bot.wait_for( + emoji, user = await self.bot.wait_for( "reaction_add", timeout=30.0, check=check ) while emoji.emoji not in [THUMBS_DOWN]: @@ -303,7 +303,7 @@ def check(e, u): await message.remove_reaction( member=message.author, emoji=THUMBS_UP ) - (emoji, user) = await self.bot.wait_for( + emoji, user = await self.bot.wait_for( "reaction_add", timeout=30.0, check=check ) diff --git a/cogs/feedback.py b/cogs/feedback.py index ee236fc..df73ff0 100644 --- a/cogs/feedback.py +++ b/cogs/feedback.py @@ -38,53 +38,67 @@ async def viewfeedback( str, ] = None, ): - await send_embed( - ctx, - "", - "**Error: **distance must be an integer (an index placevalue) if no `author_from` is given!", - ) if hasattr(distance, "upper") and author_from is None else await send_embed( - ctx, - "", - f'*`{distance}`*: "{data["feedback"]["message"][distance]}", submitted by **{data["feedback"]["author"][distance]}**' - if distance != 0 - else f"**You can index off of the index on the left side. Type `{ctx.prefix}viewfeedback `\n**\n" - + "\n".join( - [ - f"`{num}:` {data['feedback']['message'][k]}**, said by {data['feedback']['author'][k]}**" - for num, k in enumerate(range(len(data["feedback"]["message"]))) - if num <= 9 - ] - ), - a="Feedback", - i_u=ctx.author.display_avatar.url, - ) if author_from is None else await send_embed( - ctx, - "", - "\n".join( - [ - f"`{num}`: {data['feedback']['message'][num]}" - for num, k in enumerate(data["feedback"]["author"]) - if k == author_from - ] - ), - a=f"Feedback from {author_from}", - i_u=ctx.author.display_avatar.url, - f=f"All these messges are from {author_from}", - ) if hasattr( - author_from, "upper" - ) else await send_embed( - ctx, - "", - "\n".join( - [ - f"`{num}`: {data['feedback']['message'][num]}" - for num, k in enumerate(data["feedback"]["id"]) - if k == author_from - ] - ), - a=f"Feedback from {await self.bot.fetch_user(author_from)}", - i_u=ctx.author.display_avatar.url, - f=f"All these messages are from {await self.bot.fetch_user(author_from)}", + ( + await send_embed( + ctx, + "", + "**Error: **distance must be an integer (an index placevalue) if no `author_from` is given!", + ) + if hasattr(distance, "upper") and author_from is None + else ( + await send_embed( + ctx, + "", + ( + f'*`{distance}`*: "{data["feedback"]["message"][distance]}", submitted by **{data["feedback"]["author"][distance]}**' + if distance != 0 + else f"**You can index off of the index on the left side. Type `{ctx.prefix}viewfeedback `\n**\n" + + "\n".join( + [ + f"`{num}:` {data['feedback']['message'][k]}**, said by {data['feedback']['author'][k]}**" + for num, k in enumerate( + range(len(data["feedback"]["message"])) + ) + if num <= 9 + ] + ) + ), + a="Feedback", + i_u=ctx.author.display_avatar.url, + ) + if author_from is None + else ( + await send_embed( + ctx, + "", + "\n".join( + [ + f"`{num}`: {data['feedback']['message'][num]}" + for num, k in enumerate(data["feedback"]["author"]) + if k == author_from + ] + ), + a=f"Feedback from {author_from}", + i_u=ctx.author.display_avatar.url, + f=f"All these messges are from {author_from}", + ) + if hasattr(author_from, "upper") + else await send_embed( + ctx, + "", + "\n".join( + [ + f"`{num}`: {data['feedback']['message'][num]}" + for num, k in enumerate(data["feedback"]["id"]) + if k == author_from + ] + ), + a=f"Feedback from {await self.bot.fetch_user(author_from)}", + i_u=ctx.author.display_avatar.url, + f=f"All these messages are from {await self.bot.fetch_user(author_from)}", + ) + ) + ) ) @commands.command(aliases=["dial", "call", "assistance"]) diff --git a/cogs/fun/cog.py b/cogs/fun/cog.py index ae3f345..897fd55 100644 --- a/cogs/fun/cog.py +++ b/cogs/fun/cog.py @@ -264,7 +264,7 @@ async def pickemoji(self, ctx: Context): def check(e, u): return u == ctx.author and e.message.id == msg.id - (emoji, user) = await self.bot.wait_for("reaction_add", check=check) + emoji, user = await self.bot.wait_for("reaction_add", check=check) while emoji.emoji != "❌": if emoji.emoji == "➡": slide += 1 @@ -300,7 +300,7 @@ def check(e, u): await ctx.reply(f"{y} has been added!") - (emoji, user) = await self.bot.wait_for("reaction_add", check=check) + emoji, user = await self.bot.wait_for("reaction_add", check=check) else: await msg.clear_reactions() diff --git a/cogs/games/cog.py b/cogs/games/cog.py index a306adb..1b1ffc4 100644 --- a/cogs/games/cog.py +++ b/cogs/games/cog.py @@ -181,7 +181,7 @@ async def rpsfail(self, ctx: Context): def check(reaction, user): return user == ctx.author - (reaction, user) = await self.bot.wait_for("reaction_add", check=check) + reaction, user = await self.bot.wait_for("reaction_add", check=check) embed = Embed(title="Baited", colour=get_colour()) await msg.edit(embed=embed) diff --git a/cogs/games/views/blackjack.py b/cogs/games/views/blackjack.py index 43a0737..c973db5 100644 --- a/cogs/games/views/blackjack.py +++ b/cogs/games/views/blackjack.py @@ -89,11 +89,13 @@ def visual_hand(self, cards: List[Card] = None, hide_card: bool = False) -> str: player=player, bar="".join("-" for _ in range(len(player))), cards=visual_cards, - value=self.generate_card_values( - self.user_cards if not cards else self.bot_cards - ) - if not hide_card - else f"{cards[0].value} + ?", + value=( + self.generate_card_values( + self.user_cards if not cards else self.bot_cards + ) + if not hide_card + else f"{cards[0].value} + ?" + ), ) def generate_card_values(self, cards: List[Card]) -> int: diff --git a/cogs/games/views/casino.py b/cogs/games/views/casino.py index ddcb7a3..6126149 100644 --- a/cogs/games/views/casino.py +++ b/cogs/games/views/casino.py @@ -36,7 +36,7 @@ async def play(self, button: Button, interaction: MessageInteraction) -> None: await interaction.response.edit_message(embed=intsthink, view=self) r_ints = (random.randint(1, 9), random.randint(1, 9), random.randint(1, 9)) - (result, ints) = ([], None) + result, ints = ([], None) for i in r_ints: result.append(str(i)) @@ -68,7 +68,7 @@ async def retry(self, button: Button, interaction: MessageInteraction) -> None: r_ints = (random.randint(1, 9), random.randint(1, 9), random.randint(1, 9)) - (result, ints) = ([], None) + result, ints = ([], None) for i in r_ints: result.append(str(i)) ints = Embed( diff --git a/cogs/games/views/minesweeper.py b/cogs/games/views/minesweeper.py index cb91e4c..a78e60d 100644 --- a/cogs/games/views/minesweeper.py +++ b/cogs/games/views/minesweeper.py @@ -522,7 +522,7 @@ async def dig_button(self, button: Button, interaction: MessageInteraction) -> N try: user_input = message.content.split() - (row, column) = int(user_input[0]), int(user_input[-1]) + row, column = int(user_input[0]), int(user_input[-1]) except ValueError: self.button_pressed = 0 return await message.add_reaction(CLOSE) @@ -590,7 +590,7 @@ async def flag_button( try: user_input = message.content.split() - (row, column) = int(user_input[0]), int(user_input[-1]) + row, column = int(user_input[0]), int(user_input[-1]) except ValueError: self.button_pressed = 0 return await message.add_reaction(CLOSE) diff --git a/cogs/games/views/snake.py b/cogs/games/views/snake.py index 1ca37ae..9e16f71 100644 --- a/cogs/games/views/snake.py +++ b/cogs/games/views/snake.py @@ -182,32 +182,25 @@ async def move_snake(self) -> None: await self.edit_embed(self.board) @_p1 - async def _pl_1(self, _, __): - ... + async def _pl_1(self, _, __): ... @_p1 - async def _pl_2(self, _, __): - ... + async def _pl_2(self, _, __): ... @_p1 - async def _pl_3(self, _, __): - ... + async def _pl_3(self, _, __): ... @_p1 - async def _pl_4(self, _, __): - ... + async def _pl_4(self, _, __): ... @_p1 - async def _pl_5(self, _, __): - ... + async def _pl_5(self, _, __): ... @_p2 - async def _pl_6(self, _, __): - ... + async def _pl_6(self, _, __): ... @_p2 - async def _pl_7(self, _, __): - ... + async def _pl_7(self, _, __): ... @button(style=ButtonStyle.green, emoji=UP_ARROW, disabled=True) async def up(self, button: Button, interaction: MessageInteraction) -> None: @@ -219,16 +212,13 @@ async def up(self, button: Button, interaction: MessageInteraction) -> None: await interaction.response.defer() @_p2 - async def _pl_8(self, _, __): - ... + async def _pl_8(self, _, __): ... @_p2 - async def _pl_9(self, _, __): - ... + async def _pl_9(self, _, __): ... @_p3 - async def _pl_10(self, _, __): - ... + async def _pl_10(self, _, __): ... @button(style=ButtonStyle.green, emoji=LEFT_ARROW, disabled=True, row=2) async def left(self, button: Button, interaction: MessageInteraction) -> None: @@ -258,28 +248,22 @@ async def right(self, button: Button, interaction: MessageInteraction) -> None: await interaction.response.defer() @_p3 - async def _pl_11(self, _, __): - ... + async def _pl_11(self, _, __): ... @_p4 - async def _pl_12(self, _, __): - ... + async def _pl_12(self, _, __): ... @_p4 - async def _pl_13(self, _, __): - ... + async def _pl_13(self, _, __): ... @_p4 - async def _pl_14(self, _, __): - ... + async def _pl_14(self, _, __): ... @_p4 - async def _pl_15(self, _, __): - ... + async def _pl_15(self, _, __): ... @_p4 - async def _pl_16(self, _, __): - ... + async def _pl_16(self, _, __): ... @button(label="Play", style=ButtonStyle.green, emoji=PLAY_BUTTON, row=4) async def play(self, button: Button, interaction: MessageInteraction) -> None: diff --git a/cogs/help/cog.py b/cogs/help/cog.py index abc445e..ac27e0e 100644 --- a/cogs/help/cog.py +++ b/cogs/help/cog.py @@ -89,23 +89,29 @@ async def specific_command( ) .add_field( name=" ❯❯ Alias", - value=f"{', '.join(f'`{k}`' for k in command.aliases if command.aliases)} " - if command.aliases - else "`none`", + value=( + f"{', '.join(f'`{k}`' for k in command.aliases if command.aliases)} " + if command.aliases + else "`none`" + ), inline=False, ) .add_field( name=" ❯❯ Usage", - value=f"`j.{command.name} {command.signature}`" - if command.signature - else f"`j.{command.name}`", + value=( + f"`j.{command.name} {command.signature}`" + if command.signature + else f"`j.{command.name}`" + ), inline=False, ) .add_field( name=" ❯❯ Description", - value=f"{get_help(command.name)}" - if get_help(command.name) - else "Currently no help!", + value=( + f"{get_help(command.name)}" + if get_help(command.name) + else "Currently no help!" + ), inline=False, ) .set_author(name="Help", icon_url=ctx.author.display_avatar.url) @@ -152,15 +158,19 @@ async def no_command(self, ctx: Context) -> disnake.Embed: ) .add_field( name="\u200b", - value="\n".join(commands[i] for i in range(0, len(commands), 2)) - if commands - else "-", + value=( + "\n".join(commands[i] for i in range(0, len(commands), 2)) + if commands + else "-" + ), ) .add_field( name="\u200b", - value="\n".join(commands[i] for i in range(1, len(commands), 2)) - if commands - else "-", + value=( + "\n".join(commands[i] for i in range(1, len(commands), 2)) + if commands + else "-" + ), ) ) diff --git a/cogs/images.py b/cogs/images.py index c5f463b..6d35858 100644 --- a/cogs/images.py +++ b/cogs/images.py @@ -383,7 +383,7 @@ async def rotate( await img(ctx, member, "rotate") image = cv.imread("./images/rotate.png") - (h, w) = image.shape[:2] + h, w = image.shape[:2] rotation_matrix = cv.getRotationMatrix2D((w / 2, h / 2), degrees, 1) diff --git a/cogs/jesterinfo.py b/cogs/jesterinfo.py index 183b0f8..edba725 100644 --- a/cogs/jesterinfo.py +++ b/cogs/jesterinfo.py @@ -23,9 +23,9 @@ async def links(self, ctx: Context): @commands.command() async def uptime(self, ctx: Context): delta_uptime = datetime.utcnow() - self.bot.launch_time - (hours, remainder) = divmod(int(delta_uptime.total_seconds()), 3600) - (minutes, seconds) = divmod(remainder, 60) - (days, hours) = divmod(hours, 24) + hours, remainder = divmod(int(delta_uptime.total_seconds()), 3600) + minutes, seconds = divmod(remainder, 60) + days, hours = divmod(hours, 24) return await send_embed( ctx, "", diff --git a/cogs/levels.py b/cogs/levels.py index 28b1294..bb5487d 100644 --- a/cogs/levels.py +++ b/cogs/levels.py @@ -31,9 +31,9 @@ async def rankup(self, level, member): "Select * from levels_config where guild_id = ?", (member.guild.id,) ) - (chan, message) = (None, None) + chan, message = (None, None) if result is not None: - (guild, chan, ping) = result + guild, chan, ping = result if ping == "Yes": message = f"Well done {member.mention}! You ranked up to {level}" else: @@ -52,7 +52,7 @@ async def on_message(self, message: disnake.Message): return result = await self.find_or_insert_user(message.author) - (user_id, guild_id, xp, level, name) = result + user_id, guild_id, xp, level, name = result xp += random.randint(10, 40) @@ -213,7 +213,7 @@ def convert_int(integer): async def rank(self, ctx: Context, member: disnake.Member = None): member = member or ctx.author user = await self.find_or_insert_user(member) - (user_id, guild_id, xp, level, name) = user + user_id, guild_id, xp, level, name = user result = await self.bot.db.fetchone( "Select Count(*) from users where xp > ? and guild_id=?", (xp, guild_id) diff --git a/cogs/love.py b/cogs/love.py index d0e9123..126a32e 100644 --- a/cogs/love.py +++ b/cogs/love.py @@ -170,7 +170,7 @@ async def marry(self, ctx: Context, member: disnake.Member): await msg.add_reaction("💖") partner = member try: - (emoji, user) = await self.bot.wait_for( + emoji, user = await self.bot.wait_for( "reaction_add", timeout=300.0, check=lambda e, u: u == member and e.message.id == msg.id, diff --git a/cogs/misc.py b/cogs/misc.py index 5963647..47e6472 100644 --- a/cogs/misc.py +++ b/cogs/misc.py @@ -157,7 +157,7 @@ async def password(self, ctx: Context, lengthofpassword: int = 12): @commands.command(aliases=["stat"], description="Sends statistics about the server") async def stats(self, ctx: Context): - (members, bots) = [m for m in ctx.guild.members if not m.bot], [ + members, bots = [m for m in ctx.guild.members if not m.bot], [ m for m in ctx.guild.members if m.bot ] embed = disnake.Embed(title="Stats", colour=get_colour()) diff --git a/cogs/moderation.py b/cogs/moderation.py index 062f503..3518e1c 100644 --- a/cogs/moderation.py +++ b/cogs/moderation.py @@ -111,7 +111,7 @@ async def ban( try: await member.send("You have been banned: " + reason) except HTTPException: - await ctx.send("Could message user") + await ctx.send("Could message user") await member.ban(reason=reason) embed = disnake.Embed( title="Banned", @@ -137,7 +137,7 @@ async def unban(self, ctx: Context, user_id: int, *, reason="No reason provided" try: await user.send(f"You have been unbanned from {ctx.guild.name}") except HTTPException: - await ctx.send("Could message user") + await ctx.send("Could message user") @has_permissions(manage_roles=True) @commands.command(aliases=["add", "+role", "add_role"]) @@ -301,9 +301,11 @@ async def permmute(self, ctx: Context, member: disnake.Member, *, reason=None): await ctx.reply(embed=embed) await member.add_roles(mutedRole, reason=reason) try: - await member.send(f" you have been muted from: {guild.name} Reason: {reason}") + await member.send( + f" you have been muted from: {guild.name} Reason: {reason}" + ) except HTTPException: - await ctx.send("Could message user") + await ctx.send("Could message user") @commands.command( aliases=["unrmute", "runmute"], description="Unreactmutes ``" @@ -336,7 +338,7 @@ async def unreactmute(self, ctx: Context, member: disnake.Member, *, reason=None f"You have been reaction muted from: {guild.name} Reason: {reason}" ) except HTTPException: - await ctx.send("Could message user") + await ctx.send("Could message user") @commands.command(aliases=["unmut"], description="Unmutes ``") @has_permissions(manage_messages=True) @@ -366,7 +368,7 @@ async def unmute(self, ctx: Context, member: disnake.Member, *, reason=None): f"You have been reaction muted from: {guild.name} Reason: {reason}" ) except HTTPException: - await ctx.send("Could message user") + await ctx.send("Could message user") @commands.command( aliases=["tempmute"], diff --git a/cogs/music/cog.py b/cogs/music/cog.py index 9b0c087..ce82ce9 100644 --- a/cogs/music/cog.py +++ b/cogs/music/cog.py @@ -145,7 +145,7 @@ async def skip(self, ctx: Context): @commands.command() async def volume(self, ctx: Context, vol: str): player = self.music.get_player(guild_id=ctx.guild.id) - (song, volume) = await player.change_volume( + song, volume = await player.change_volume( float(vol) / 100 ) # volume should be a float between 0 to 1 await embed2(ctx, f"**Changed volume for:** *{song.name}* **to {volume*100}**%") diff --git a/cogs/music/dcutils.py b/cogs/music/dcutils.py index 1e6368e..b3e5c1e 100644 --- a/cogs/music/dcutils.py +++ b/cogs/music/dcutils.py @@ -248,19 +248,11 @@ def __init__(self, ctx, music, **kwargs): if self.ctx.guild.id not in self.music.queue.keys(): self.music.queue[self.ctx.guild.id] = [] self.after_func = check_queue - self.on_play_func = ( - self.on_queue_func - ) = ( - self.on_skip_func - ) = ( + self.on_play_func = self.on_queue_func = self.on_skip_func = ( self.on_stop_func - ) = ( - self.on_pause_func - ) = ( - self.on_resume_func - ) = ( - self.on_loop_toggle_func - ) = self.on_volume_change_func = self.on_remove_from_queue_func = None + ) = self.on_pause_func = self.on_resume_func = self.on_loop_toggle_func = ( + self.on_volume_change_func + ) = self.on_remove_from_queue_func = None ffmpeg_error = kwargs.get( "ffmpeg_error_betterfix", kwargs.get("ffmpeg_error_fix") ) diff --git a/cogs/random.py b/cogs/random.py index 136af62..bf2881f 100644 --- a/cogs/random.py +++ b/cogs/random.py @@ -28,16 +28,14 @@ async def bored(self, ctx: Context) -> None: ) as resp: await resp.json() - await ctx.em( - """```yaml + await ctx.em("""```yaml ++ -- Are you bored? -- ++ [Activity:] {json['activity']} [Type:] {json['type']} [Participants required:] {json['participants']} [Price:] {json['price']} {'[Link:]' + json['link'] if json['link'] else ''}``` - """ - ) + """) @commands.command() async def age(self, ctx: Context, name: str) -> None: @@ -55,8 +53,7 @@ async def weather(self, ctx: Context, *, city: str) -> None: ) as resp: await resp.json() - await ctx.em( - """```yaml + await ctx.em("""```yaml ++ -- Weather info for {city} -- ++ [Temperature:] - temp : {json['main']['temp']} @@ -72,8 +69,7 @@ async def weather(self, ctx: Context, *, city: str) -> None: [Pressure:] {json['main']['pressure']} [Humidity:] {json['main']['humidity']} [Visibility:] {json['visibility']}``` - """ - ) + """) @commands.command() async def spacex(self, ctx: Context) -> None: @@ -82,11 +78,9 @@ async def spacex(self, ctx: Context) -> None: ) as resp: await resp.json() - await ctx.em( - """```yaml + await ctx.em("""```yaml ++ -- Spacex latest info -- ++ -{pprint.pformat(json)}```""" - ) +{pprint.pformat(json)}```""") @commands.command() async def screenshot(self, ctx: Context, *, url): @@ -108,10 +102,8 @@ async def geek(self, ctx: Context) -> None: ) as resp: await resp.json() - await ctx.em( - """```yaml -{json}```""" - ) + await ctx.em("""```yaml +{json}```""") @commands.command() async def blank(self, ctx: Context) -> None: @@ -136,11 +128,9 @@ async def trump(self, ctx: Context) -> None: ) as resp: await resp.json() - await ctx.em( - """```yaml + await ctx.em("""```yaml [Trump quote:] {random.choice(json['messages']['personalized'])}``` - """ - ) + """) @commands.command(name="fool") async def april_fools(self, ctx: Context) -> None: @@ -149,7 +139,7 @@ async def april_fools(self, ctx: Context) -> None: Path("./resources/seasonal/april_fools_videos.json").read_text("utf-8") ) ) - (channel, url) = (video["channel"], video["url"]) + channel, url = (video["channel"], video["url"]) await ctx.reply(f"Check out this April Fools' video by {channel}.\n\n{url}") diff --git a/cogs/staff.py b/cogs/staff.py index 2db2e81..04b58a2 100644 --- a/cogs/staff.py +++ b/cogs/staff.py @@ -32,7 +32,7 @@ async def push(self, ctx: Context, reason): stderr=asyncio.subprocess.PIPE, ) - (output, error) = await process.communicate() + output, error = await process.communicate() embed.description += f'[{" ".join(git_command)!r} exited with return code {process.returncode}\n' if output: @@ -54,7 +54,7 @@ async def pull(self, ctx: Context): stderr=asyncio.subprocess.PIPE, ) - (output, error) = await process.communicate() + output, error = await process.communicate() embed.description += f'[{" ".join(git_command)!r} exited with return code {process.returncode}\n' if output: @@ -614,7 +614,7 @@ async def resolve(self, ctx: Context, errornum: str = None): ) ) await m.add_reaction(THUMBS_UP) - (reaction, user) = await self.bot.wait_for( + reaction, user = await self.bot.wait_for( "reaction_add", check=lambda r, u: u == ctx.author ) await send_embed(ctx, "", "Done") diff --git a/cogs/trivia.py b/cogs/trivia.py index 36d8583..422bceb 100644 --- a/cogs/trivia.py +++ b/cogs/trivia.py @@ -57,7 +57,7 @@ async def get_question(self): @commands.command(aliases=["question"]) async def trivia_question(self, ctx: Context) -> None: - (content, answer) = await self.get_question() + content, answer = await self.get_question() await ctx.em(content) msg = await self.bot.wait_for( @@ -87,7 +87,7 @@ async def trivia_play(self, ctx: Context) -> None: num = 0 while True: - (content, answer) = await self.get_question() + content, answer = await self.get_question() bot_msg = await ctx.em(content) try: diff --git a/cogs/utils/cog.py b/cogs/utils/cog.py index 3478776..5e959b6 100644 --- a/cogs/utils/cog.py +++ b/cogs/utils/cog.py @@ -139,7 +139,10 @@ async def charinfo(self, ctx: Context, *, characters: str): def get_info( char: str, - ) -> Tuple[str, str,]: + ) -> Tuple[ + str, + str, + ]: digit = f"{ord(char):x}" if len(digit) <= 4: u_code = f"\\u{digit:>04}" @@ -152,7 +155,7 @@ def get_info( ) return (info, u_code) - (char_list, raw_list) = zip(*(get_info(c) for c in characters)) + char_list, raw_list = zip(*(get_info(c) for c in characters)) embed = disnake.Embed(colour=get_colour()) embed.add_field(name="Character info", value="\n".join(char_list)) if len(characters) > 1: @@ -172,11 +175,11 @@ async def fibonacci(self, ctx: Context, sequences=10000000000000): if sequences > 1000000000000000: sequences = 100000000000000 - (a, b) = (0, 1) + a, b = (0, 1) while a < sequences: x.append(str(a)) - (a, b) = (b, a + b) + a, b = (b, a + b) embed = disnake.Embed( title="Fibinaci", description=f"{', '.join(x)}", colour=get_colour() diff --git a/core/context.py b/core/context.py index c7e6b78..3e974f3 100644 --- a/core/context.py +++ b/core/context.py @@ -107,7 +107,7 @@ def check(r, u): return try: - (r, u) = await arg.bot.wait_for( + r, u = await arg.bot.wait_for( "reaction_add", check=check, timeout=250 ) if str(r.emoji.id) == TRASHCAN[11:-1]: @@ -164,7 +164,7 @@ def check(r, u): return try: - (r, u) = await arg.bot.wait_for( + r, u = await arg.bot.wait_for( "reaction_add", check=check, timeout=250 ) if str(r.emoji.id) == TRASHCAN[11:-1]: diff --git a/core/errors.py b/core/errors.py index 6c49f16..6cf525c 100644 --- a/core/errors.py +++ b/core/errors.py @@ -129,7 +129,7 @@ def check(e, u): await msg.add_reaction(close) await msg.add_reaction(right) try: - (emoji, user) = await ctx.bot.wait_for( + emoji, user = await ctx.bot.wait_for( "reaction_add", timeout=60.0, check=check ) @@ -173,7 +173,7 @@ def check(e, u): ) await msg.remove_reaction(member=ctx.author, emoji=left) - (emoji, user) = await ctx.bot.wait_for( + emoji, user = await ctx.bot.wait_for( "reaction_add", timeout=60.0, check=lambda r, u: u == ctx.author, diff --git a/core/paginator.py b/core/paginator.py index 61d36e5..b31bee3 100644 --- a/core/paginator.py +++ b/core/paginator.py @@ -61,7 +61,7 @@ async def paginate(self, **kwargs): def check(e, u): return u == self.ctx.author and e.message == msg - (e, u) = await self.ctx.bot.wait_for("reaction_add", check=check) + e, u = await self.ctx.bot.wait_for("reaction_add", check=check) while str(e.emoji) != l["close"]: name = str(e.emoji) @@ -88,7 +88,7 @@ def check(e, u): top=self._top, ) - (e, u) = await self.ctx.bot.wait_for("reaction_add", check=check) + e, u = await self.ctx.bot.wait_for("reaction_add", check=check) else: return await msg.clear_reactions() diff --git a/core/utils/utils.py b/core/utils/utils.py index 0157f2c..a293e05 100644 --- a/core/utils/utils.py +++ b/core/utils/utils.py @@ -20,10 +20,7 @@ def get_colour() -> int: async def send_embed( - channel: disnake.abc.Messageable, - title: str, - description: str = None, - **kwargs + channel: disnake.abc.Messageable, title: str, description: str = None, **kwargs ) -> disnake.Message: from core.context import Context diff --git a/pyproject.toml b/pyproject.toml index 8c4eaa6..154df8c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,2 @@ [tool.ruff] -ignore = [ - "F401" -] \ No newline at end of file +ignore = [ "F401" ]