From e967acce50137b57ed9ad64304070de73f474a0a Mon Sep 17 00:00:00 2001 From: Piotr Zalewski Date: Mon, 30 Oct 2023 15:58:32 +0000 Subject: [PATCH] pass it through black --- commands/calculator.py | 4 +--- commands/joke.py | 4 +++- commands/moderation.py | 24 ++++++++++-------------- commands/quote.py | 4 ++++ 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/commands/calculator.py b/commands/calculator.py index 31c8c00..69f1bd6 100644 --- a/commands/calculator.py +++ b/commands/calculator.py @@ -12,9 +12,7 @@ async def calculator(ctx: lightbulb.Context): try: if ctx.options.expression in ["0/0", "0 / 0"]: - return await ctx.respond( - "I don't know" - ) + return await ctx.respond("I don't know") result = eval(ctx.options.expression) except ZeroDivisionError: return await ctx.respond("Not Approved") diff --git a/commands/joke.py b/commands/joke.py index a8c5c02..66d6d6c 100644 --- a/commands/joke.py +++ b/commands/joke.py @@ -7,7 +7,9 @@ async def fetch_joke(): async with aiohttp.ClientSession() as session: - async with session.get("https://official-joke-api.appspot.com/random_joke") as response: + async with session.get( + "https://official-joke-api.appspot.com/random_joke" + ) as response: data = await response.json() return data diff --git a/commands/moderation.py b/commands/moderation.py index d0e43b5..076e7e4 100644 --- a/commands/moderation.py +++ b/commands/moderation.py @@ -7,38 +7,34 @@ @plugin.command() -@lightbulb.option( - "reason", "Reason for the ban", type=str, required=True -) -@lightbulb.option( - "member", "The person to ban", type=hikari.Member, required=True -) +@lightbulb.option("reason", "Reason for the ban", type=str, required=True) +@lightbulb.option("member", "The person to ban", type=hikari.Member, required=True) @lightbulb.add_checks(lightbulb.has_guild_permissions(hikari.Permissions.BAN_MEMBERS)) @lightbulb.command("ban", "Ban a user from the server") @lightbulb.implements(lightbulb.SlashCommand) async def ban(ctx: lightbulb.Context): try: await ctx.get_guild().ban(ctx.options.member, reason=ctx.options.reason) - await ctx.respond(f"{ctx.options.member} has been banned from the server for: {ctx.options.reason}") + await ctx.respond( + f"{ctx.options.member} has been banned from the server for: {ctx.options.reason}" + ) except Exception as e: logging.error(f"An error occurred while banning {str(ctx.options.member)}: {e}") await ctx.respond(f"An error occurred while banning {str(ctx.options.member)}") @plugin.command() -@lightbulb.option( - "reason", "Reason for the kick", type=str, required=True -) -@lightbulb.option( - "member", "The person to kick", type=hikari.Member, required=True -) +@lightbulb.option("reason", "Reason for the kick", type=str, required=True) +@lightbulb.option("member", "The person to kick", type=hikari.Member, required=True) @lightbulb.add_checks(lightbulb.has_guild_permissions(hikari.Permissions.KICK_MEMBERS)) @lightbulb.command("kick", "Kick a user from the server") @lightbulb.implements(lightbulb.SlashCommand) async def kick(ctx: lightbulb.Context): try: await ctx.get_guild().kick(ctx.options.member, reason=ctx.options.reason) - await ctx.respond(f"{str(ctx.options.member)} has been kicked from the server for: {ctx.options.reason}") + await ctx.respond( + f"{str(ctx.options.member)} has been kicked from the server for: {ctx.options.reason}" + ) except Exception as e: logging.error(f"An error occurred while kicking {str(ctx.options.member)}: {e}") await ctx.respond(f"An error occurred while kicking {str(ctx.options.member)}") diff --git a/commands/quote.py b/commands/quote.py index bf5de6e..e7493fc 100644 --- a/commands/quote.py +++ b/commands/quote.py @@ -3,12 +3,14 @@ plugin = lightbulb.Plugin(name="Quote") + async def fetch_random_quote(): async with aiohttp.ClientSession() as session: async with session.get("https://api.quotable.io/random") as response: data = await response.json() return data + @plugin.command() @lightbulb.command("quote", "Fetch a random quote") @lightbulb.implements(lightbulb.SlashCommand) @@ -24,8 +26,10 @@ async def quote(ctx: lightbulb.Context): except Exception as e: await ctx.respond(f"An error occurred: {str(e)}") + def load(bot): bot.add_plugin(plugin) + def unload(bot): bot.remove_plugin(plugin)