From 645a2858148bd9ae36b0ad8060db0ade5cb0aa62 Mon Sep 17 00:00:00 2001 From: EllieJaybee Date: Wed, 11 Sep 2024 18:33:19 +0800 Subject: [PATCH] Formatting --- bot/plugins/context/context.py | 4 +- bot/plugins/main/anime.py | 102 +++++++++++++++++++++++++------ bot/plugins/main/events.py | 2 +- bot/plugins/main/google.py | 42 +++++++++++-- bot/plugins/main/rng.py | 19 +++++- bot/plugins/main/utils.py | 10 ++- bot/plugins/privileges/femboy.py | 6 +- bot/plugins/privileges/member.py | 19 +++++- bot/plugins/privileges/mod.py | 16 ++++- bot/plugins/reddit/reddit.py | 27 ++++++-- 10 files changed, 206 insertions(+), 41 deletions(-) diff --git a/bot/plugins/context/context.py b/bot/plugins/context/context.py index 62fc42f..c64f9ed 100644 --- a/bot/plugins/context/context.py +++ b/bot/plugins/context/context.py @@ -13,7 +13,9 @@ class NoSauceError(IndexError): @plugin.include -@crescent.message_command(name="Find Sauce", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.message_command( + name="Find Sauce", default_member_permissions=hikari.Permissions.VIEW_CHANNEL +) async def sauce(ctx: crescent.Context, message: hikari.Message): await ctx.defer(ephemeral=True) sauceclient = SauceNao(api_key=plugin.model.secret.SAUCE_TOKEN, results_limit=1) diff --git a/bot/plugins/main/anime.py b/bot/plugins/main/anime.py index 185619f..c89cf20 100644 --- a/bot/plugins/main/anime.py +++ b/bot/plugins/main/anime.py @@ -29,7 +29,11 @@ async def action( @plugin.include -@crescent.command(name="bite", description="Bite someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="bite", + description="Bite someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class BiteCommand: target = crescent.option(hikari.User, "Who do you want to bite?") @@ -38,7 +42,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="boop", description="Boop someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="boop", + description="Boop someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class BoopCommand: target = crescent.option(hikari.User, "Who do you want to boop?") @@ -47,7 +55,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="bully", description="Bully someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="bully", + description="Bully someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class BullyCommand: target = crescent.option(hikari.User, "Who do you want to bully?") @@ -56,7 +68,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="cuddle", description="Cuddle someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="cuddle", + description="Cuddle someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class CuddleCommand: target = crescent.option(hikari.User, "Who do you want to cuddle?") @@ -65,7 +81,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="greet", description="Greet someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="greet", + description="Greet someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class WaveCommand: target = crescent.option(hikari.User, "Who do you want to greet?") @@ -74,7 +94,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="handhold", description="Hold someone's hand!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="handhold", + description="Hold someone's hand!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class HoldCommand: target = crescent.option(hikari.User, "Who do you want to hold?") @@ -83,7 +107,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="hug", description="Hug someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="hug", + description="Hug someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class HugCommand: target = crescent.option(hikari.User, "Who do you want to hug?") @@ -92,7 +120,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="highfive", description="Highfive someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="highfive", + description="Highfive someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class FiveCommand: target = crescent.option(hikari.User, "Who do you want to highfive?") @@ -101,7 +133,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="kill", description="Kill someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="kill", + description="Kill someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class KillCommand: target = crescent.option(hikari.User, "Who do you want to kill?") @@ -110,7 +146,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="kiss", description="Kiss someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="kiss", + description="Kiss someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class KissCommand: target = crescent.option(hikari.User, "Who do you want to kiss?") @@ -119,7 +159,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="lick", description="Lick someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="lick", + description="Lick someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class LickCommand: target = crescent.option(hikari.User, "Who do you want to lick?") @@ -128,7 +172,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="pat", description="Pat someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="pat", + description="Pat someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class PatCommand: target = crescent.option(hikari.User, "Who do you want to pat?") @@ -137,7 +185,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="poke", description="Poke someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="poke", + description="Poke someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class PokeCommand: target = crescent.option(hikari.User, "Who do you want to poke?") @@ -146,7 +198,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="punch", description="Punch someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="punch", + description="Punch someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class PunchCommand: target = crescent.option(hikari.User, "Who do you want to punch?") @@ -155,7 +211,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="slap", description="Slap someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="slap", + description="Slap someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class SlapCommand: target = crescent.option(hikari.User, "Who do you want to slap?") @@ -164,7 +224,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="stare", description="Stare at someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="stare", + description="Stare at someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class StareCommand: target = crescent.option(hikari.User, "Who do you want to stare at?") @@ -173,7 +237,11 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="tickle", description="Tickle someone!", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="tickle", + description="Tickle someone!", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class TickleCommand: target = crescent.option(hikari.User, "Who do you want to tickle?") diff --git a/bot/plugins/main/events.py b/bot/plugins/main/events.py index 03923f7..c93e0c4 100644 --- a/bot/plugins/main/events.py +++ b/bot/plugins/main/events.py @@ -37,7 +37,7 @@ async def startup(event: hikari.GuildAvailableEvent): for channel_id in guild.get_channels(): channel = guild.get_channel(channel_id) logger.debug(f"L Connected to #{channel.name}({channel.id})") - logger.debug('-') + logger.debug("-") @plugin.include diff --git a/bot/plugins/main/google.py b/bot/plugins/main/google.py index f6a0e6a..dcf8ba5 100644 --- a/bot/plugins/main/google.py +++ b/bot/plugins/main/google.py @@ -40,18 +40,28 @@ async def _search(ctx: crescent.Context, query: str) -> hikari.Message | None: @plugin.include -@crescent.command(name="search", description="Fetches the first google search result", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="search", + description="Fetches the first google search result", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Search: query = crescent.option(str, "Query to be searched") + async def callback(self, ctx: crescent.Context): await ctx.defer() await _search(ctx, self.query) @plugin.include -@crescent.command(name="answer", description="Answers your burning questions, powered by google", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="answer", + description="Answers your burning questions, powered by google", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Answer: query = crescent.option(str, "Your question") + async def callback(self, ctx: crescent.Context): await ctx.defer() soup = await request(params={"q": self.query}) @@ -60,9 +70,14 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="calculate", description="Calculates stuff humanly, powered by google", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="calculate", + description="Calculates stuff humanly, powered by google", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Calculate: query = crescent.option(str, "Your math question") + async def callback(self, ctx: crescent.Context): await ctx.defer() soup = await request(params={"q": self.query}) @@ -77,9 +92,14 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="define", description="Defines a word or phrase queried, powered by google", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="define", + description="Defines a word or phrase queried, powered by google", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Define: query = crescent.option(str, "Phrase to be defined") + async def callback(self, ctx: crescent.Context): await ctx.defer() soup = await request(params={"q": f"define {self.query}"}) @@ -104,9 +124,14 @@ async def callback(self, ctx: crescent.Context): @plugin.include -@crescent.command(name="weather", description="Gives a weather forecast for query, powered by google", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="weather", + description="Gives a weather forecast for query, powered by google", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Weather: query = crescent.option(str, "Location/time query") + async def callback(self, ctx: crescent.Context): await ctx.defer() soup = await request(params={"q": f"weather {self.query}"}) @@ -177,9 +202,14 @@ async def get_hires_link(response: dict | bs) -> str | None: @plugin.include -@crescent.command(name="image", description="Fetches the first (lowres) image of the query on google", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="image", + description="Fetches the first (lowres) image of the query on google", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Image: query = crescent.option(str, "Image to search for") + async def callback(self, ctx: crescent.Context): await ctx.defer() soup = await request( diff --git a/bot/plugins/main/rng.py b/bot/plugins/main/rng.py index ade095b..78cc365 100644 --- a/bot/plugins/main/rng.py +++ b/bot/plugins/main/rng.py @@ -6,7 +6,10 @@ @plugin.include -@crescent.command(description="Pick a random member", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + description="Pick a random member", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) async def pickmember(ctx: crescent.Context): membersview = plugin.app.cache.get_members_view_for_guild(ctx.guild_id) await ctx.respond( @@ -18,18 +21,28 @@ async def pickmember(ctx: crescent.Context): @plugin.include -@crescent.command(name="rng", description="Generates a random number in a range", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="rng", + description="Generates a random number in a range", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class RNG: min = crescent.option(int, "Lowest number") max = crescent.option(int, "Highest number") + async def callback(self, ctx: crescent.Context): await ctx.respond(random.randint(self.min, self.max)) @plugin.include -@crescent.command(name="pick", description="Pick randomly from a list of choices", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="pick", + description="Pick randomly from a list of choices", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Pick: choices = crescent.option(str, "Choices separated by commas") + async def callback(self, ctx: crescent.Context): choice_list = self.choices.split(",") await ctx.respond( diff --git a/bot/plugins/main/utils.py b/bot/plugins/main/utils.py index 0905bcc..14b4738 100644 --- a/bot/plugins/main/utils.py +++ b/bot/plugins/main/utils.py @@ -5,7 +5,10 @@ @plugin.include -@crescent.command(description="Check connection to server", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + description="Check connection to server", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) async def ping(ctx: crescent.Context): latency = round(plugin.app.heartbeat_latency, 5) * 100 await ctx.respond(f"{latency}ms") @@ -14,6 +17,9 @@ async def ping(ctx: crescent.Context): @plugin.include -@crescent.command(description="Prints the bot's source code", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + description="Prints the bot's source code", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) async def source(ctx: crescent.Context): await ctx.respond("https://github.com/EllieJaybee/31113") diff --git a/bot/plugins/privileges/femboy.py b/bot/plugins/privileges/femboy.py index 7595178..aeee97e 100644 --- a/bot/plugins/privileges/femboy.py +++ b/bot/plugins/privileges/femboy.py @@ -30,9 +30,13 @@ async def give_member(ctx: crescent.Context, member: hikari.Member): @plugin.include @crescent.hook(is_femboy) @crescent.command( - name="member", description="Grant Member role", guild=938699961112096768, default_member_permissions=hikari.Permissions.VIEW_CHANNEL + name="member", + description="Grant Member role", + guild=938699961112096768, + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, ) class MemberSlash: member = crescent.option(hikari.User, "Person to be a member") + async def callback(self, ctx: crescent.Context): await give_member(ctx, self.member) diff --git a/bot/plugins/privileges/member.py b/bot/plugins/privileges/member.py index 1232768..25babb6 100644 --- a/bot/plugins/privileges/member.py +++ b/bot/plugins/privileges/member.py @@ -8,9 +8,15 @@ @plugin.include @crescent.hook(is_member) -@crescent.command(name="roleicon", description="Change role icon", guild=938699961112096768, default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="roleicon", + description="Change role icon", + guild=938699961112096768, + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class RoleIcon: icon = crescent.option(hikari.Attachment, "Icon to be applied to role") + async def callback(self, ctx: crescent.Context): for role in ctx.member.get_roles(): if role.colour != hikari.Colour.from_int(0): @@ -22,7 +28,10 @@ async def callback(self, ctx: crescent.Context): @plugin.include @crescent.hook(is_member) @crescent.command( - name="roleicon-clear", description="Clear role icon", guild=938699961112096768, default_member_permissions=hikari.Permissions.VIEW_CHANNEL + name="roleicon-clear", + description="Clear role icon", + guild=938699961112096768, + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, ) async def roleicon_clear(ctx: crescent.Context): for role in ctx.member.get_roles(): @@ -34,7 +43,11 @@ async def roleicon_clear(ctx: crescent.Context): @plugin.include @crescent.hook(is_member) -@crescent.message_command(name="Report Message", guild=938699961112096768, default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.message_command( + name="Report Message", + guild=938699961112096768, + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) async def report_message(ctx: crescent.Context, message: hikari.Message): await ctx.respond(content="Report received", ephemeral=True) report_channel: hikari.GuildTextChannel = ctx.guild.get_channel(1140965929824567377) diff --git a/bot/plugins/privileges/mod.py b/bot/plugins/privileges/mod.py index ed79531..cb5c843 100644 --- a/bot/plugins/privileges/mod.py +++ b/bot/plugins/privileges/mod.py @@ -8,9 +8,15 @@ @plugin.include @crescent.hook(is_mod) -@crescent.command(name="1984", description="Assert Dominance", guild=938699961112096768, default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="1984", + description="Assert Dominance", + guild=938699961112096768, + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Mute1984: member = crescent.option(hikari.User, "Member to silence") + async def callback(self, ctx: crescent.Context): log_channel: hikari.TextableChannel = ctx.guild.get_channel(939418125894553611) member: hikari.Member = self.member @@ -29,9 +35,15 @@ async def callback(self, ctx: crescent.Context): @plugin.include @crescent.hook(is_mod) -@crescent.command(name="free", description="Release prisoner", guild=938699961112096768, default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="free", + description="Release prisoner", + guild=938699961112096768, + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class Free1984: member = crescent.option(hikari.User, "Prisoner to free") + async def callback(self, ctx: crescent.Context): member: hikari.Member = self.member if 939351651217735760 not in member.role_ids: diff --git a/bot/plugins/reddit/reddit.py b/bot/plugins/reddit/reddit.py index 3419b70..451e68b 100644 --- a/bot/plugins/reddit/reddit.py +++ b/bot/plugins/reddit/reddit.py @@ -55,32 +55,49 @@ async def reddit(ctx: crescent.Context | miru.ViewContext, subreddit: str): @plugin.include -@crescent.command(name="reddit", description="Fetches hot reddit stuff", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + name="reddit", + description="Fetches hot reddit stuff", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) class RedditClassCommand: subreddit = crescent.option(str, "subreddit you wanna fetch") + async def callback(self, ctx: crescent.Context): await reddit(ctx, self.subreddit) @plugin.include -@crescent.command(description="Fetches a random hot reddit femboy post", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + description="Fetches a random hot reddit femboy post", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) async def femboy(ctx: crescent.Context): await reddit(ctx, "Femboys") @plugin.include -@crescent.command(description="Fetches a random hot reddit trap hentai post", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + description="Fetches a random hot reddit trap hentai post", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) async def trap(ctx: crescent.Context): await reddit(ctx, "traphentai") @plugin.include -@crescent.command(description="Fetches a random hot reddit hentai post", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + description="Fetches a random hot reddit hentai post", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) async def hentai(ctx: crescent.Context): await reddit(ctx, "hentai") @plugin.include -@crescent.command(description="Fetches cat pics", default_member_permissions=hikari.Permissions.VIEW_CHANNEL) +@crescent.command( + description="Fetches cat pics", + default_member_permissions=hikari.Permissions.VIEW_CHANNEL, +) async def meow(ctx: crescent.Context): await reddit(ctx, "cats")