From 1511e9d205ce98629f28371381d097a8b74503b8 Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Sat, 17 May 2025 10:08:09 +0530 Subject: [PATCH 1/2] Improve punctuation in descriptions of some commands --- cogs/afk.py | 6 +++--- cogs/automod.py | 24 ++++++++++++------------ cogs/devtools.py | 2 +- cogs/fun.py | 2 +- cogs/isobank.py | 2 +- cogs/isocard.py | 4 ++-- cogs/isocoin.py | 4 ++-- cogs/levelling.py | 2 +- cogs/maths.py | 30 +++++++++++++++--------------- cogs/minigames.py | 4 ++-- 10 files changed, 40 insertions(+), 40 deletions(-) diff --git a/cogs/afk.py b/cogs/afk.py index d91929f..b8e5494 100644 --- a/cogs/afk.py +++ b/cogs/afk.py @@ -22,7 +22,7 @@ def __init__(self, bot): @afk_system.command( name="set", - description="Sets your AFK status with a custom response" + description="Sets your AFK status with a custom response." ) @commands.guild_only() @option(name="response", description="What do you want your AFK response to be?", type=str, default="I'm AFK") @@ -33,7 +33,7 @@ async def afk_set(self, ctx: ApplicationContext, response: str="I'm AFK"): @afk_system.command( name="remove", - description="Removes your AFK status" + description="Removes your AFK status." ) @commands.guild_only() async def afk_remove(self, ctx: ApplicationContext): @@ -43,7 +43,7 @@ async def afk_remove(self, ctx: ApplicationContext): @afk_system.command( name="mod_remove", - description="Removes an AFK status for someone else" + description="Removes an AFK status for someone else." ) @commands.guild_only() @option(name="user", description="Whose AFK status do you want to remove?", type=discord.User) diff --git a/cogs/automod.py b/cogs/automod.py index 3041573..f4f5233 100644 --- a/cogs/automod.py +++ b/cogs/automod.py @@ -20,7 +20,7 @@ def __init__(self, bot): @automod_cmds.command( name="config", - description="Shows the current automod configuration for your server" + description="Shows the current automod configuration for your server." ) @commands.guild_only() async def automod_config(self, ctx: ApplicationContext): @@ -35,7 +35,7 @@ async def automod_config(self, ctx: ApplicationContext): # Swear-filter Commands @automod_cmds.command( name="swearfilter", - description="Turn on or off automod's swear-filter in your server" + description="Turn on or off automod's swear-filter in your server." ) @commands.guild_only() @option(name="toggle", description="Do you want to turn it on or off?", type=bool) @@ -48,7 +48,7 @@ async def automod_swearfilter(self, ctx: ApplicationContext, toggle: bool): @automod_cmds.command( name="use_default_keywords", - description="Choose whether or not you want to use the default keywords for automod's swear-filter" + description="Choose whether or not you want to use the default keywords for automod's swear-filter." ) @commands.guild_only() @option(name="toggle", description="Do you want to turn it on or off?", type=bool) @@ -61,7 +61,7 @@ async def automod_use_default_keywords(self, ctx: ApplicationContext, toggle: bo @automod_cmds.command( name="view_custom_keywords", - description="Shows a list of the custom automod swear-filter keywords set for your server", + description="Shows a list of the custom automod swear-filter keywords set for your server.", ) @commands.guild_only() async def automod_view_custom_keywords(self, ctx: ApplicationContext): @@ -79,7 +79,7 @@ async def automod_view_custom_keywords(self, ctx: ApplicationContext): @automod_cmds.command( name="add_custom_keyword", - description="Adds a custom keyword to your server's swear-filter" + description="Adds a custom keyword to your server's swear-filter." ) @commands.guild_only() @option(name="keyword", description="What keyword do you want to add?", type=str) @@ -94,7 +94,7 @@ async def automod_add_custom_keyword(self, ctx: ApplicationContext, keyword:str) @automod_cmds.command( name="remove_custom_keyword", - description="Removes a custom keyword (matching its id) from your server's swear-filter" + description="Removes a custom keyword (matching its id) from your server's swear-filter." ) @commands.guild_only() @option(name="id", description="What's the id of the keyword to remove (can be found through /automod_view_custom_keywords", type=int) @@ -108,7 +108,7 @@ async def automod_remove_custom_keyword(self, ctx: ApplicationContext, id: int): # Link Blocker Commands @automod_cmds.command( name="linkblocker", - description="Turn on or off automod's link blocker in your server" + description="Turn on or off automod's link blocker in your server." ) @commands.guild_only() @option(name="toggle", description="Do you want to turn it on or off?", type=bool) @@ -121,7 +121,7 @@ async def automod_linkblocker(self, ctx: ApplicationContext, toggle: bool): @automod_cmds.command( name="linkblocker_only_whitelisted", - description="Only allows whitelisted links in the server and blocks all other links" + description="Only allows whitelisted links in the server and blocks all other links." ) @commands.guild_only() @option(name="toggle", description="Do you want to turn it on or off?", type=bool) @@ -162,7 +162,7 @@ async def automod_linkblocker_add_blacklist(self, ctx: ApplicationContext, link: @automod_cmds.command( name="linkblocker_view_whitelisted", - description="Shows a list of the whitelisted links set for this server", + description="Shows a list of the whitelisted links set for this server.", ) @commands.guild_only() async def automod_view_custom_keywords(self, ctx: ApplicationContext): @@ -180,7 +180,7 @@ async def automod_view_custom_keywords(self, ctx: ApplicationContext): @automod_cmds.command( name="linkblocker_view_blacklisted", - description="Shows a list of the blacklisted links set for this server", + description="Shows a list of the blacklisted links set for this server.", ) @commands.guild_only() async def automod_view_custom_keywords(self, ctx: ApplicationContext): @@ -198,7 +198,7 @@ async def automod_view_custom_keywords(self, ctx: ApplicationContext): @automod_cmds.command( name="linkblocker_remove_blacklist", - description="Removes a blacklisted link (matching its id) from this server's link blocker" + description="Removes a blacklisted link (matching its id) from this server's link blocker." ) @commands.guild_only() @option(name="id", description="What's the id of the link to remove? (can be found through /automod_view_blacklisted_links", type=int) @@ -211,7 +211,7 @@ async def automod_linkblocker_remove_blacklist(self, ctx: ApplicationContext, id @automod_cmds.command( name="linkblocker_remove_whitelist", - description="Removes a whitelisted link (matching its id) from this server's link blocker" + description="Removes a whitelisted link (matching its id) from this server's link blocker." ) @commands.guild_only() @option(name="id", description="What's the id of the link to remove? (can be found through /automod_view_whitelisted_links", type=int) diff --git a/cogs/devtools.py b/cogs/devtools.py index 9b6483c..72a586c 100644 --- a/cogs/devtools.py +++ b/cogs/devtools.py @@ -28,7 +28,7 @@ def __init__(self, bot): @devtools.command( name='modify_balance', - description="Modifies user balance (Normal Digit: Adds Balance; Negative Digit: Removes Balance)" + description="Modifies user balance. (Normal Digit: Adds Balance; Negative Digit: Removes Balance)" ) @option(name="user", description="Specify the user to change their balance", type=discord.User) @option(name="modifier", description="Specify the balance to modify", type=int) diff --git a/cogs/fun.py b/cogs/fun.py index 8dd33d6..8ceedc7 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -19,7 +19,7 @@ def __init__(self, bot): @commands.slash_command( name='stroketranslate', - description='Gives you the ability to make full words and sentences from a cluster of letters' + description='Gives you the ability to make full words and sentences from a cluster of letters!' ) @option(name="strok", description="What do you want to translate?", type=str) async def stroketranslate(self, ctx: ApplicationContext, strok: str): diff --git a/cogs/isobank.py b/cogs/isobank.py index a1be55c..374a725 100644 --- a/cogs/isobank.py +++ b/cogs/isobank.py @@ -23,7 +23,7 @@ def __init__(self, bot): @commands.slash_command( name="isobank_register", - description="Registers a new IsoBank account with your Discord ID" + description="Registers a new IsoBank account with your Discord ID." ) @option(name="pin", description="Your new account's authentication ID. Must be a 6-digit integer.", type=int) async def isobank_register(self, ctx: ApplicationContext, pin:int): diff --git a/cogs/isocard.py b/cogs/isocard.py index adb01f5..bd97d78 100644 --- a/cogs/isocard.py +++ b/cogs/isocard.py @@ -103,7 +103,7 @@ async def my_card(self, ctx: ApplicationContext): @isocard.command( name="options_label", - description="Set your IsoCard's label" + description="Set your IsoCard's label." ) @option(name="card_number", description="Enter your card number that you want to work with.", type=int) @option(name="new_label", description="What do you want your new card label to be?", type=str, default=None) @@ -137,7 +137,7 @@ async def verify_transaction(self, ctx: ApplicationContext, verification_code: i @isocard.command( name="transaction_history", - description="View all your past transactions (paid and received)" + description="View all your past transactions. (paid and received)" ) @option(name="transaction_type", description="Which type of transactions do you want to view?", type=str, choices=["paid", "received"]) @option(name="page", description="Select the page number that you want to view (1 page = 5 logs)", type=int, default=1) diff --git a/cogs/isocoin.py b/cogs/isocoin.py index e76567a..3f2fe21 100644 --- a/cogs/isocoin.py +++ b/cogs/isocoin.py @@ -39,7 +39,7 @@ def __init__(self, bot): @isocoin_system.command( name="balance", - description="See your IsoCoin balances" + description="See your IsoCoin balance." ) async def isocoin_balance(self, ctx: ApplicationContext): localembed = discord.Embed(description=f"You currently have **{isocoins[str(ctx.author.id)]}** IsoCoins.") @@ -47,7 +47,7 @@ async def isocoin_balance(self, ctx: ApplicationContext): @isocoin_system.command( name="daily", - description="Collect your daily reward of IsoCoins" + description="Collect your daily reward of IsoCoins." ) @commands.cooldown(1, 86400, commands.BucketType.user) async def isocoin_daily(self, ctx: ApplicationContext): diff --git a/cogs/levelling.py b/cogs/levelling.py index 3344ef2..1304107 100644 --- a/cogs/levelling.py +++ b/cogs/levelling.py @@ -18,7 +18,7 @@ def __init__(self, bot): @commands.slash_command( name="rank", - description="Shows your rank or another user's rank" + description="Shows your rank or another user's rank." ) @option(name="user", description="Who's rank do you want to view?", type=discord.User, default=None) async def rank(self, ctx: ApplicationContext, user: discord.User=None): diff --git a/cogs/maths.py b/cogs/maths.py index 36892a6..cddd19f 100644 --- a/cogs/maths.py +++ b/cogs/maths.py @@ -18,7 +18,7 @@ def __init__(self, bot): self.bot = bot @math.command( name="squareroot", - description="Finds the square root of any positive number" + description="Finds the square root of any positive number." ) @option(name="number", description="Which number do you want to find the root of?", type=int) async def squareroot(self, ctx: ApplicationContext, number: int): @@ -59,7 +59,7 @@ async def math_solve_quadratic_roots(self, ctx: ApplicationContext, coeff_a: int @math.command( name="area_square", - description="Finds the area of a square" + description="Finds the area of a square." ) @option(name="length", description="What is the length of one side?", type=int) async def area_square(self, ctx: ApplicationContext, length: int): @@ -71,7 +71,7 @@ async def area_square(self, ctx: ApplicationContext, length: int): @math.command( name="area_rectangle", - description="Finds the area of a rectangle" + description="Finds the area of a rectangle." ) @option(name="length", description="What is the length?", type=int) @option(name="breadth", description="What is the breadth?", type=int) @@ -85,7 +85,7 @@ async def area_rectangle(self, ctx: ApplicationContext, length: int, breadth: in @math.command( name="area_circle", - description="Finds the area of a circle" + description="Finds the area of a circle." ) @option(name="radius", description="What is the radius of the circle?", type=int) @option(name="pi", description="Set a value for Ļ€ (default is 22/7)", type=str, choices=["22/7", "3.14", "3"], default="22/7") @@ -102,7 +102,7 @@ async def area_circle(self, ctx: ApplicationContext, radius: int, pi: str = "22/ @math.command( name="area_triangle", - description="Finds the area of a triangle (using Heron's formula)" + description="Finds the area of a triangle. (using Heron's formula)" ) @option(name="side_length_a", description="What is the length of side A of the triangle?", type=int) @option(name="side_length_b", description="What is the length of side B of the triangle?", type=int) @@ -121,7 +121,7 @@ async def area_triangle(self, ctx: ApplicationContext, side_length_a: int, side_ # Volume Commands @math.command( name="volume_cuboid", - description="Find the volume of a cuboid (use only length for volume of cube)" + description="Find the volume of a cuboid. (use only length for volume of cube)" ) @option(name="length", description="The length of the cuboid", type=float) @option(name="breadth", description="The breadth of the cuboid", type=float, default=None) @@ -138,7 +138,7 @@ async def volume_cuboid(self, ctx: ApplicationContext, length: float, breadth: f @math.command( name="volume_sphere", - description="Find the volume of a sphere" + description="Find the volume of a sphere." ) @option(name="radius", description="The radius of the corresponding sphere", type=float) async def volume_sphere(self, ctx: ApplicationContext, radius: float): @@ -150,7 +150,7 @@ async def volume_sphere(self, ctx: ApplicationContext, radius: float): @math.command( name="volume_hemisphere", - description="Find the volume of a hemisphere" + description="Find the volume of a hemisphere." ) @option(name="radius", description="The radius of the corresponding hemisphere", type=float) async def volume_sphere(self, ctx: ApplicationContext, radius: float): @@ -162,7 +162,7 @@ async def volume_sphere(self, ctx: ApplicationContext, radius: float): @math.command( name="volume_cylinder", - description="Find the volume of a cylinder" + description="Find the volume of a cylinder." ) @option(name="radius", description="The radius of the cylinder", type=float) @option(name="height", description="The height of the cylinder", type=float) @@ -175,7 +175,7 @@ async def volume_cylinder(self, ctx: ApplicationContext, radius: float, height: @math.command( name="volume_cone", - description="Find the volume of a cone" + description="Find the volume of a cone." ) @option(name="radius", description="The radius of the base of the cone", type=float) @option(name="height", description="The height of the cone", type=float) @@ -189,7 +189,7 @@ async def volume_cylinder(self, ctx: ApplicationContext, radius: float, height: # Surface Area Commands @math.command( name="surfacearea_cuboid", - description="Find the surface area of a cuboid" + description="Find the surface area of a cuboid. (use only length for cube)" ) @option(name="length", description="The length of the cuboid", type=float) @option(name="breadth", description="The breadth of the cuboid", type=float, default=None) @@ -206,7 +206,7 @@ async def surfacearea_cuboid(self, ctx: ApplicationContext, length: float, bread @math.command( name="surfacearea_sphere", - description="Find the surface area of a sphere" + description="Find the surface area of a sphere." ) @option(name="radius", description="The radius of the sphere", type=float) async def surfacearea_sphere(self, ctx: ApplicationContext, radius: float): @@ -218,7 +218,7 @@ async def surfacearea_sphere(self, ctx: ApplicationContext, radius: float): @math.command( name="surfacearea_hemisphere", - description="Find the surface area of a hemisphere" + description="Find the surface area of a hemisphere." ) @option(name="mode", description="Do you want to calculate for CSA or TSA?", type=str, choices=["CSA", "TSA"]) @option(name="radius", description="The radius of the hemisphere", type=float) @@ -236,7 +236,7 @@ async def surfacearea_hemisphere(self, ctx: ApplicationContext, mode: str, radiu @math.command( name="surfacearea_cylinder", - description="Find the surface area of a cylinder" + description="Find the surface area of a cylinder." ) @option(name="mode", description="Do you want to calculate for CSA or TSA?", type=str, choices=["CSA", "TSA"]) @option(name="radius", description="The radius of the cylinder", type=float) @@ -255,7 +255,7 @@ async def surfacearea_cylinder(self, ctx: ApplicationContext, mode: str, radius: @math.command( name="surfacearea_cone", - description="Find the surface area of a cone" + description="Find the surface area of a cone." ) @option(name="mode", description="Do you want to calculate for CSA or TSA?", type=str, choices=["CSA", "TSA"]) @option(name="radius", description="The radius of the cone", type=float) diff --git a/cogs/minigames.py b/cogs/minigames.py index 9def8c2..ae95c36 100644 --- a/cogs/minigames.py +++ b/cogs/minigames.py @@ -20,7 +20,7 @@ def __init__(self, bot): @commands.slash_command( name="guessthenumber", - description="Guess a random number from 1 to 10 that the bot is thinking about" + description="Guess a random number from 1 to 10 that the bot is thinking about!" ) @commands.cooldown(1, 10, commands.BucketType.user) async def guessthenumber(self, ctx: ApplicationContext): @@ -38,7 +38,7 @@ def check(msg): return msg.author == ctx.author and msg.channel == ctx.channel a @commands.slash_command( name="highlow", - description="Guess whether the actual number is higher or lower than the hint number" + description="Guess whether the actual number is higher or lower than the hint number!" ) @commands.cooldown(1, 40, commands.BucketType.user) async def highlow(self, ctx: ApplicationContext): From 5b5e2572f2f54e31394f5bcddc6cc901dfbed43f Mon Sep 17 00:00:00 2001 From: snipe <72265661+notsniped@users.noreply.github.com> Date: Sat, 17 May 2025 10:32:05 +0530 Subject: [PATCH 2/2] Add missing docstrings for some commands --- cogs/afk.py | 3 +++ cogs/automod.py | 16 +++++++++++++++- cogs/devtools.py | 3 +++ cogs/fun.py | 1 + cogs/isobank.py | 1 + cogs/isocard.py | 7 ++++++- cogs/isocoin.py | 3 +++ cogs/levelling.py | 1 + cogs/maths.py | 15 +++++++++++++++ cogs/minigames.py | 2 ++ cogs/weather.py | 3 +++ 11 files changed, 53 insertions(+), 2 deletions(-) diff --git a/cogs/afk.py b/cogs/afk.py index b8e5494..1056fdf 100644 --- a/cogs/afk.py +++ b/cogs/afk.py @@ -27,6 +27,7 @@ def __init__(self, bot): @commands.guild_only() @option(name="response", description="What do you want your AFK response to be?", type=str, default="I'm AFK") async def afk_set(self, ctx: ApplicationContext, response: str="I'm AFK"): + """Sets your AFK status with a custom response.""" presence.add_afk(ctx.guild.id, ctx.user.id, response) localembed = discord.Embed(title=f"{ctx.author.display_name} is now AFK.", description=f"Response: {response}", color=discord.Color.dark_orange()) await ctx.respond(embed=localembed) @@ -37,6 +38,7 @@ async def afk_set(self, ctx: ApplicationContext, response: str="I'm AFK"): ) @commands.guild_only() async def afk_remove(self, ctx: ApplicationContext): + """Removes your AFK status.""" status = presence.remove_afk(ctx.guild.id, ctx.author.id) if status == 0: return await ctx.respond(f"Alright {ctx.author.mention}, I've removed your AFK.") elif status == 1: return await ctx.respond("You weren't previously AFK.", ephemeral=True) @@ -48,6 +50,7 @@ async def afk_remove(self, ctx: ApplicationContext): @commands.guild_only() @option(name="user", description="Whose AFK status do you want to remove?", type=discord.User) async def afk_mod_remove(self, ctx: ApplicationContext, user:discord.User): + """Removes an AFK status for someone else.""" if not ctx.author.guild_permissions.manage_messages: return await ctx.respond("You don't have the required permissions to use this.", ephemeral=True) status = presence.remove_afk(ctx.guild.id, user.id) if status == 0: return await ctx.respond(f"{user.display_name}'s AFK has been removed.") diff --git a/cogs/automod.py b/cogs/automod.py index f4f5233..da112fa 100644 --- a/cogs/automod.py +++ b/cogs/automod.py @@ -24,6 +24,7 @@ def __init__(self, bot): ) @commands.guild_only() async def automod_config(self, ctx: ApplicationContext): + """Shows the current automod configuration for your server.""" loaded_config = automod.fetch_config(ctx.guild.id) localembed = discord.Embed(title=f"{ctx.guild.name}\'s automod configuration", description="Use the `/automod_set` command to change your server's automod configuration.", color=color) localembed.set_thumbnail(url=ctx.guild.icon) @@ -40,6 +41,7 @@ async def automod_config(self, ctx: ApplicationContext): @commands.guild_only() @option(name="toggle", description="Do you want to turn it on or off?", type=bool) async def automod_swearfilter(self, ctx: ApplicationContext, toggle: bool): + """Turn on or off automod's swear-filter in your server.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) if automod.fetch_config(ctx.guild.id)["swear_filter"]["enabled"] == toggle: return await ctx.respond(f"That automod option is already set to `{toggle}`.", ephemeral=True) automod.swearfilter_enabled(ctx.guild.id, toggle) @@ -53,6 +55,7 @@ async def automod_swearfilter(self, ctx: ApplicationContext, toggle: bool): @commands.guild_only() @option(name="toggle", description="Do you want to turn it on or off?", type=bool) async def automod_use_default_keywords(self, ctx: ApplicationContext, toggle: bool): + """Choose whether or not you want to use the default keywords for automod's swear-filter.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) if automod.fetch_config(ctx.guild.id)["swear_filter"]["keywords"]["use_default"] == toggle: return await ctx.respond(f"That automod option is already set to `{toggle}`.", ephemeral=True) automod.swearfilter_usedefaultkeywords(ctx.guild.id, toggle) @@ -65,6 +68,7 @@ async def automod_use_default_keywords(self, ctx: ApplicationContext, toggle: bo ) @commands.guild_only() async def automod_view_custom_keywords(self, ctx: ApplicationContext): + """Shows a list of the custom automod swear-filter keywords set for your server.""" loaded_config = automod.fetch_config(ctx.guild.id) out = "" if loaded_config["swear_filter"]["keywords"]["custom"] != []: @@ -83,7 +87,8 @@ async def automod_view_custom_keywords(self, ctx: ApplicationContext): ) @commands.guild_only() @option(name="keyword", description="What keyword do you want to add?", type=str) - async def automod_add_custom_keyword(self, ctx: ApplicationContext, keyword:str): + async def automod_add_custom_keyword(self, ctx: ApplicationContext, keyword: str): + """Adds a custom keyword to your server's swear-filter.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) loaded_config = automod.fetch_config(ctx.guild.id) if keyword not in loaded_config["swear_filter"]["keywords"]["custom"]: @@ -99,6 +104,7 @@ async def automod_add_custom_keyword(self, ctx: ApplicationContext, keyword:str) @commands.guild_only() @option(name="id", description="What's the id of the keyword to remove (can be found through /automod_view_custom_keywords", type=int) async def automod_remove_custom_keyword(self, ctx: ApplicationContext, id: int): + """Removes a custom keyword (matching its id) from your server's swear-filter.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) try: automod.swearfilter_removekeyword(ctx.guild.id, id) @@ -113,6 +119,7 @@ async def automod_remove_custom_keyword(self, ctx: ApplicationContext, id: int): @commands.guild_only() @option(name="toggle", description="Do you want to turn it on or off?", type=bool) async def automod_linkblocker(self, ctx: ApplicationContext, toggle: bool): + """Turn on or off automod's link blocker in your server.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) if automod.fetch_config(ctx.guild.id)["link_blocker"]["enabled"] == toggle: return await ctx.respond(f"That automod option is already set to `{toggle}`.", ephemeral=True) automod.linkblocker_enabled(ctx.guild.id, toggle) @@ -126,6 +133,7 @@ async def automod_linkblocker(self, ctx: ApplicationContext, toggle: bool): @commands.guild_only() @option(name="toggle", description="Do you want to turn it on or off?", type=bool) async def automod_linkblocker_only_whitelisted_links(self, ctx: ApplicationContext, toggle: bool): + """Only allows whitelisted links in the server and blocks all other links.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) if automod.fetch_config(ctx.guild.id)["link_blocker"]["use_whitelist_only"] == toggle: return await ctx.respond(f"That automod option is already set to `{toggle}`.", ephemeral=True) automod.linkblocker_enabled(ctx.guild.id, toggle) @@ -139,6 +147,7 @@ async def automod_linkblocker_only_whitelisted_links(self, ctx: ApplicationConte @commands.guild_only() @option(name="link", description="The link that you want to add (must be in form of https://{url})", type=str) async def automod_linkblocker_add_whitelist(self, ctx: ApplicationContext, link: str): + """Adds a link to your server link blocker's whitelist.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) if link in automod.fetch_config(ctx.guild.id)["link_blocker"]["whitelist"]: return await ctx.respond("This link is already in your server's link blocker whitelist.", ephemeral=True) if "https://" in link or "http://" in link: @@ -153,6 +162,7 @@ async def automod_linkblocker_add_whitelist(self, ctx: ApplicationContext, link: @commands.guild_only() @option(name="link", description="The link that you want to add (must be in form of https://{url})", type=str) async def automod_linkblocker_add_blacklist(self, ctx: ApplicationContext, link: str): + """Adds a link to your server link blocker's blacklist.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) if link in automod.fetch_config(ctx.guild.id)["link_blocker"]["blacklist"]: return await ctx.respond("This link is already in your server's link blocker blacklist.", ephemeral=True) if "https://" in link or "http://" in link: @@ -166,6 +176,7 @@ async def automod_linkblocker_add_blacklist(self, ctx: ApplicationContext, link: ) @commands.guild_only() async def automod_view_custom_keywords(self, ctx: ApplicationContext): + """Shows a list of the whitelisted links set for this server.""" loaded_config = automod.fetch_config(ctx.guild.id) out = "" if loaded_config["link_blocker"]["whitelisted"] != []: @@ -184,6 +195,7 @@ async def automod_view_custom_keywords(self, ctx: ApplicationContext): ) @commands.guild_only() async def automod_view_custom_keywords(self, ctx: ApplicationContext): + """Shows a list of the blacklisted links set for this server.""" loaded_config = automod.fetch_config(ctx.guild.id) out = "" if loaded_config["link_blocker"]["blacklisted"] != []: @@ -203,6 +215,7 @@ async def automod_view_custom_keywords(self, ctx: ApplicationContext): @commands.guild_only() @option(name="id", description="What's the id of the link to remove? (can be found through /automod_view_blacklisted_links", type=int) async def automod_linkblocker_remove_blacklist(self, ctx: ApplicationContext, id: int): + """Removes a blacklisted link (matching its id) from this server's link blocker.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) try: automod.linkblocker_remove_blacklisted(ctx.guild.id, id) @@ -216,6 +229,7 @@ async def automod_linkblocker_remove_blacklist(self, ctx: ApplicationContext, id @commands.guild_only() @option(name="id", description="What's the id of the link to remove? (can be found through /automod_view_whitelisted_links", type=int) async def automod_linkblocker_remove_whitelist(self, ctx: ApplicationContext, id: int): + """Removes a whitelisted link (matching its id) from this server's link blocker.""" if not ctx.author.guild_permissions.administrator: return await ctx.respond("You cannot use this command. If you think this is a mistake, please contact your server owner/administrator.", ephemeral=True) try: automod.linkblocker_remove_whitelisted(ctx.guild.id, id) diff --git a/cogs/devtools.py b/cogs/devtools.py index 72a586c..4559ff4 100644 --- a/cogs/devtools.py +++ b/cogs/devtools.py @@ -33,6 +33,7 @@ def __init__(self, bot): @option(name="user", description="Specify the user to change their balance", type=discord.User) @option(name="modifier", description="Specify the balance to modify", type=int) async def modify_balance(self, ctx: ApplicationContext, user: discord.User, modifier: int): + """Modifies user balance. (Normal Digit: Adds Balance; Negative Digit: Removes Balance)""" if str(ctx.author.id) not in fetch_superusers(): return ctx.respond("This command is usable only by **developers** and **bot superusers**.", ephemeral=True) try: currency.add(user.id, modifier) @@ -46,6 +47,7 @@ async def modify_balance(self, ctx: ApplicationContext, user: discord.User, modi @option(name="user", description="Who's rank do you want to edit?", type=discord.User) @option(name="new_rank", description="The new rank you want to set for the user", type=int) async def edit_rank(self, ctx: ApplicationContext, user: discord.User, new_rank: int): + """Edits a user's rank.""" if str(ctx.author.id) not in fetch_superusers(): return await ctx.respond("This command is usable only by **developers** and **bot superusers**.", ephemeral=True) try: levelling.set_level(user.id, new_rank) @@ -59,6 +61,7 @@ async def edit_rank(self, ctx: ApplicationContext, user: discord.User, new_rank: @option(name="user", description="Who's rank do you want to edit?", type=discord.User) @option(name="new_xp", description="The new xp count you want to set for the user", type=int) async def edit_xp(self, ctx: ApplicationContext, user: discord.User, new_xp: int): + """Edits a user's XP.""" if str(ctx.author.id) not in fetch_superusers(): return await ctx.respond("This command is usable only by **developers** and **bot superusers**.", ephemeral=True) try: levelling.set_xp(user.id, new_xp) diff --git a/cogs/fun.py b/cogs/fun.py index 8ceedc7..51aceab 100644 --- a/cogs/fun.py +++ b/cogs/fun.py @@ -23,6 +23,7 @@ def __init__(self, bot): ) @option(name="strok", description="What do you want to translate?", type=str) async def stroketranslate(self, ctx: ApplicationContext, strok: str): + """Gives you the ability to make full words and sentences from a cluster of letters!""" if len(strok) > 300: return await ctx.respond("Please use no more than `300` character length", ephemeral=True) else: with open(f"{client_data_dir}/config/words.json", "r", encoding="utf-8") as f: words = json.load(f) diff --git a/cogs/isobank.py b/cogs/isobank.py index 374a725..c7801e0 100644 --- a/cogs/isobank.py +++ b/cogs/isobank.py @@ -27,6 +27,7 @@ def __init__(self, bot): ) @option(name="pin", description="Your new account's authentication ID. Must be a 6-digit integer.", type=int) async def isobank_register(self, ctx: ApplicationContext, pin:int): + """Registers a new IsoBank account with your Discord ID.""" isobankauth.register(ctx.author.id, pin) await ctx.respond("Congratulations! Your new IsoBank account has been registered.", ephemeral=True) diff --git a/cogs/isocard.py b/cogs/isocard.py index bd97d78..9fa11ef 100644 --- a/cogs/isocard.py +++ b/cogs/isocard.py @@ -39,6 +39,7 @@ def __init__(self, bot): ) @option(name="ssc", description="The Special Security Code for your new card. (aka. CVV)", type=int) async def register(self, ctx: ApplicationContext, ssc: int): + """Register a new IsoCard in your account.""" new_card_id = generate_card_id() new_card_data = isocard_db.generate(new_card_id, ctx.author.id, ctx.author.name, ssc) localembed = discord.Embed(title=":tada: Congratulations!", description="Your new IsoCard has successfully been registered!", color=discord.Color.green()) @@ -55,6 +56,7 @@ async def register(self, ctx: ApplicationContext, ssc: int): ) @option(name="card_number", description="Enter your card number of the card you want to view.", type=int) async def info(self, ctx: ApplicationContext, card_number: int): + """View information on your IsoCard.""" try: try: card_data = isocard_db.fetch_card_data(card_number) except KeyError: return await ctx.respond("There was a problem with your card number. Please check it and try again.", ephemeral=True) @@ -80,6 +82,7 @@ async def info(self, ctx: ApplicationContext, card_number: int): description="View a list of all your cards." ) async def my_card(self, ctx: ApplicationContext): + """View a list of all your cards.""" all_card_numbers = isocard_db.fetch_all_cards() isocard_database = isocard_db.raw() your_cards = list() @@ -108,6 +111,7 @@ async def my_card(self, ctx: ApplicationContext): @option(name="card_number", description="Enter your card number that you want to work with.", type=int) @option(name="new_label", description="What do you want your new card label to be?", type=str, default=None) async def options_label(self, ctx: ApplicationContext, card_number: int, new_label: str): + """Set your IsoCard's label.""" try: card_data = isocard_db.fetch_card_data(card_number) except KeyError: return await ctx.respond("There was a problem with your card number. Please check it and try again.", ephemeral=True) if card_data["cardholder_user_id"] != ctx.author.id: return await ctx.respond("You do not have permission to access this IsoCard.\n If you think this is an error, please contact the devs.", ephemeral=True) @@ -121,6 +125,7 @@ async def options_label(self, ctx: ApplicationContext, card_number: int, new_lab ) @option(name="verification_code", description="The 6-digit verification code for your transaction", type=int) async def verify_transaction(self, ctx: ApplicationContext, verification_code: int): + """Verify an ongoing transaction.""" try: with open(f"{client_data_dir}/database/isocard_transactions.json", 'r') as f: transactions_db = json.load(f) if transactions_db[str(verification_code)]["payer_id"] == ctx.author.id: @@ -142,7 +147,7 @@ async def verify_transaction(self, ctx: ApplicationContext, verification_code: i @option(name="transaction_type", description="Which type of transactions do you want to view?", type=str, choices=["paid", "received"]) @option(name="page", description="Select the page number that you want to view (1 page = 5 logs)", type=int, default=1) async def transaction_history(self, ctx: ApplicationContext, transaction_type: str, page: int = 1): - """View all your past transactions (paid and received)""" + """View all your past transactions. (paid and received)""" transactions_db = isocardtxn.fetch_raw() if transaction_type == "paid": diff --git a/cogs/isocoin.py b/cogs/isocoin.py index 3f2fe21..8c3f88f 100644 --- a/cogs/isocoin.py +++ b/cogs/isocoin.py @@ -42,6 +42,7 @@ def __init__(self, bot): description="See your IsoCoin balance." ) async def isocoin_balance(self, ctx: ApplicationContext): + """See your IsoCoin balance.""" localembed = discord.Embed(description=f"You currently have **{isocoins[str(ctx.author.id)]}** IsoCoins.") await ctx.respond(embed=localembed) @@ -51,6 +52,7 @@ async def isocoin_balance(self, ctx: ApplicationContext): ) @commands.cooldown(1, 86400, commands.BucketType.user) async def isocoin_daily(self, ctx: ApplicationContext): + """Collect your daily reward of IsoCoins.""" isocoins_reward = random.randint(2500, 5000) isocoins[str(ctx.author.id)] += isocoins_reward save() @@ -61,6 +63,7 @@ async def isocoin_daily(self, ctx: ApplicationContext): description="See all the items that you can buy using your IsoCoins." ) async def isocoin_shop(self, ctx: ApplicationContext): + """See all the items that you can buy using your IsoCoins.""" await ctx.respond("IsoCoin shop is coming soon! Check back later for new items.") # Cog Initialization diff --git a/cogs/levelling.py b/cogs/levelling.py index 1304107..9fb0aa8 100644 --- a/cogs/levelling.py +++ b/cogs/levelling.py @@ -41,6 +41,7 @@ async def rank(self, ctx: ApplicationContext, user: discord.User=None): description="View the global leaderboard for user levelling ranks." ) async def leaderboard_levels(self, ctx: ApplicationContext): + """View the global leaderboard for user levelling ranks.""" await ctx.defer() levels = levelling.get_raw() levels_dict = dict() diff --git a/cogs/maths.py b/cogs/maths.py index cddd19f..fe0c3bf 100644 --- a/cogs/maths.py +++ b/cogs/maths.py @@ -22,6 +22,7 @@ def __init__(self, bot): self.bot = bot ) @option(name="number", description="Which number do you want to find the root of?", type=int) async def squareroot(self, ctx: ApplicationContext, number: int): + """Finds the square root of any positive number.""" if number < 0: localembed = discord.Embed(description="The square root of a negative number is an imaginary number.", color=color) localembed.set_footer(text=f"√({number}) = i√{number}") @@ -63,6 +64,7 @@ async def math_solve_quadratic_roots(self, ctx: ApplicationContext, coeff_a: int ) @option(name="length", description="What is the length of one side?", type=int) async def area_square(self, ctx: ApplicationContext, length: int): + """Finds the area of a square.""" if length < 0: return await ctx.respond("Length cannot be lower than 0 units.") result = length * length localembed = discord.Embed(title=f"Area of square of side {length} units", description=f"{result} sq. units", color=color) @@ -76,6 +78,7 @@ async def area_square(self, ctx: ApplicationContext, length: int): @option(name="length", description="What is the length?", type=int) @option(name="breadth", description="What is the breadth?", type=int) async def area_rectangle(self, ctx: ApplicationContext, length: int, breadth: int): + """Finds the area of a rectangle.""" if length < 0: return await ctx.respond("Length cannot be lower than 0 units.") elif breadth < 0: return await ctx.respond("Breadth cannot be lower than 0 units.") result = length * breadth @@ -90,6 +93,7 @@ async def area_rectangle(self, ctx: ApplicationContext, length: int, breadth: in @option(name="radius", description="What is the radius of the circle?", type=int) @option(name="pi", description="Set a value for Ļ€ (default is 22/7)", type=str, choices=["22/7", "3.14", "3"], default="22/7") async def area_circle(self, ctx: ApplicationContext, radius: int, pi: str = "22/7"): + """Finds the area of a circle.""" if radius < 0: return await ctx.respond("Radius cannot be lower than 0 units.") if pi == "22/7": result = (22/7) * (radius * radius) elif pi == "3.14": result = 3.14 * (radius * radius) @@ -108,6 +112,7 @@ async def area_circle(self, ctx: ApplicationContext, radius: int, pi: str = "22/ @option(name="side_length_b", description="What is the length of side B of the triangle?", type=int) @option(name="side_length_c", description="What is the length of side C of the triangle?", type=int) async def area_triangle(self, ctx: ApplicationContext, side_length_a: int, side_length_b: int, side_length_c: int): + """Finds the area of a triangle. (using Heron's formula)""" if side_length_a < 0 or side_length_b < 0 or side_length_c < 0: return await ctx.respond("Any side of the triangle cannot be less than 0.") s = (side_length_a + side_length_b + side_length_c)/2 eq1 = s - side_length_a @@ -127,6 +132,7 @@ async def area_triangle(self, ctx: ApplicationContext, side_length_a: int, side_ @option(name="breadth", description="The breadth of the cuboid", type=float, default=None) @option(name="height", description="The height/depth of the cuboid", type=float, default=None) async def volume_cuboid(self, ctx: ApplicationContext, length: float, breadth: float = None, height: float = None): + """Find the volume of a cuboid. (use only length for volume of cube)""" if (breadth != None and height == None) or (height != None and breadth == None): return await ctx.respond("Both `breadth` and `height` arguments needs to be filled!") if breadth == None and height == None: breadth = length @@ -142,6 +148,7 @@ async def volume_cuboid(self, ctx: ApplicationContext, length: float, breadth: f ) @option(name="radius", description="The radius of the corresponding sphere", type=float) async def volume_sphere(self, ctx: ApplicationContext, radius: float): + """Find the volume of a sphere.""" if radius < 0: return await ctx.respond("The radius of the sphere cannot be negative.") result = ((22/7) * (radius ** 3)) * 4/3 localembed = discord.Embed(title=f"Volume of sphere of radius {radius} units", description=f"{result} cu. units", color=color) @@ -154,6 +161,7 @@ async def volume_sphere(self, ctx: ApplicationContext, radius: float): ) @option(name="radius", description="The radius of the corresponding hemisphere", type=float) async def volume_sphere(self, ctx: ApplicationContext, radius: float): + """Find the volume of a hemisphere.""" if radius < 0: return await ctx.respond("The radius of the hemisphere cannot be negative.") result = ((22/7) * (radius ** 3)) * 2/3 localembed = discord.Embed(title=f"Volume of hemisphere of radius {radius} units", description=f"{result} cu. units", color=color) @@ -167,6 +175,7 @@ async def volume_sphere(self, ctx: ApplicationContext, radius: float): @option(name="radius", description="The radius of the cylinder", type=float) @option(name="height", description="The height of the cylinder", type=float) async def volume_cylinder(self, ctx: ApplicationContext, radius: float, height: float): + """Find the volume of a cylinder.""" if radius < 0 or height < 0: return await ctx.respond("The `radius` and `height` arguments cannot be negative!") result = ((22/7) * (radius ** 2)) * height localembed = discord.Embed(title=f"Volume of cylinder (radius: {radius}, height: {height})", description=f"{result} cu. units", color=color) @@ -180,6 +189,7 @@ async def volume_cylinder(self, ctx: ApplicationContext, radius: float, height: @option(name="radius", description="The radius of the base of the cone", type=float) @option(name="height", description="The height of the cone", type=float) async def volume_cylinder(self, ctx: ApplicationContext, radius: float, height: float): + """Find the volume of a cone.""" if radius < 0 or height < 0: return await ctx.respond("The `radius` and `height` arguments cannot be negative!") result = (1/3) * (((22/7) * (radius ** 2)) * height) localembed = discord.Embed(title=f"Volume of cone (base radius: {radius}, height: {height})", description=f"{result} cu. units", color=color) @@ -195,6 +205,7 @@ async def volume_cylinder(self, ctx: ApplicationContext, radius: float, height: @option(name="breadth", description="The breadth of the cuboid", type=float, default=None) @option(name="height", description="The height/depth of the cuboid", type=float, default=None) async def surfacearea_cuboid(self, ctx: ApplicationContext, length: float, breadth: float = None, height: float = None): + """Find the surface area of a cuboid. (use only length for cube)""" if (breadth != None and height == None) or (height != None and breadth == None): return await ctx.respond("Both `breadth` and `height` arguments needs to be filled!") if breadth == None and height == None: breadth = length @@ -210,6 +221,7 @@ async def surfacearea_cuboid(self, ctx: ApplicationContext, length: float, bread ) @option(name="radius", description="The radius of the sphere", type=float) async def surfacearea_sphere(self, ctx: ApplicationContext, radius: float): + """Find the surface area of a sphere.""" if radius < 0: return await ctx.respond("The `radius` argument cannot be negative!") result = 4 * ((22/7) * (radius ** 2)) localembed = discord.Embed(title=f"Surface Area of sphere of radius {radius} units", description=f"{result} sq. units", color=color) @@ -223,6 +235,7 @@ async def surfacearea_sphere(self, ctx: ApplicationContext, radius: float): @option(name="mode", description="Do you want to calculate for CSA or TSA?", type=str, choices=["CSA", "TSA"]) @option(name="radius", description="The radius of the hemisphere", type=float) async def surfacearea_hemisphere(self, ctx: ApplicationContext, mode: str, radius: float): + """Find the surface area of a hemisphere.""" if radius < 0: return await ctx.respond("The `radius` argument cannot be negative!") if mode == "CSA": result = 2 * ((22/7) * (radius ** 2)) @@ -242,6 +255,7 @@ async def surfacearea_hemisphere(self, ctx: ApplicationContext, mode: str, radiu @option(name="radius", description="The radius of the cylinder", type=float) @option(name="height", description="The height of the cylinder", type=float) async def surfacearea_cylinder(self, ctx: ApplicationContext, mode: str, radius: float, height: float): + """Find the surface area of a cylinder.""" if radius < 0 or height < 0: return await ctx.respond("The `radius` and `height` arguments cannot be negative!") if mode == "CSA": result = 2 * (22/7) * radius * height @@ -261,6 +275,7 @@ async def surfacearea_cylinder(self, ctx: ApplicationContext, mode: str, radius: @option(name="radius", description="The radius of the cone", type=float) @option(name="height", description="The height of the cone", type=float) async def surfacearea_cone(self, ctx: ApplicationContext, mode: str, radius: float, height: float): + """Find the surface area of a cone.""" if radius < 0 or height < 0: return await ctx.respond("The `radius` and `height` arguments cannot be negative!") slant_height = round(sqrt(radius + height), 3) if mode == "CSA": diff --git a/cogs/minigames.py b/cogs/minigames.py index ae95c36..7196bf7 100644 --- a/cogs/minigames.py +++ b/cogs/minigames.py @@ -24,6 +24,7 @@ def __init__(self, bot): ) @commands.cooldown(1, 10, commands.BucketType.user) async def guessthenumber(self, ctx: ApplicationContext): + """Guess a random number from 1 to 10 that the bot is thinking about!""" number = randint(1, 10) localembed = discord.Embed(title="Guess the number!", description="I am currently thinking of a number from 1 to 10. Can you guess what it is?", color=color) localembed.set_footer(text="If you guess what it is, you will win 500 to 1000 coins!") @@ -42,6 +43,7 @@ def check(msg): return msg.author == ctx.author and msg.channel == ctx.channel a ) @commands.cooldown(1, 40, commands.BucketType.user) async def highlow(self, ctx: ApplicationContext): + """Guess whether the actual number is higher or lower than the hint number!""" numb = randint(1, 100) numb2 = randint(1, 100) coins = randint(300, 1000) diff --git a/cogs/weather.py b/cogs/weather.py index 3ea92f9..0867f4c 100644 --- a/cogs/weather.py +++ b/cogs/weather.py @@ -24,6 +24,7 @@ def __init__(self, bot): ) @option(name="location", description="What location do you want to set?", type=str) async def weather_set_location(self, ctx: ApplicationContext, location: str): + """Set your default location for the /weather command.""" weather.new(ctx.author.id) test_ping = requests.get(f"https://api.openweathermap.org/data/2.5/weather?q={location}&appid={api_key}").content test_ping_json = json.loads(test_ping) @@ -39,6 +40,7 @@ async def weather_set_location(self, ctx: ApplicationContext, location: str): ) @option(name="scale", description="Which scale do you want to use?", type=str, choices=["Celsius", "Fahrenheit", "Kelvin"]) async def weather_set_scale(self, ctx: ApplicationContext, scale: str): + """Set your preferred unit scale for temperature for the /weather command.""" weather.new(ctx.author.id) if scale not in ["Celsius", "Fahrenheit", "Kelvin"]: return 1 weather.set_scale(ctx.author.id, scale) @@ -51,6 +53,7 @@ async def weather_set_scale(self, ctx: ApplicationContext, scale: str): ) @option(name="location", description="The location you want weather info about (leave empty for set location)", type=str, default=None) async def weather(self, ctx: ApplicationContext, location: str = None): + """See the current weather conditions of your set location, or another location.""" weather.new(ctx.author.id) if location == None: if weather.get_default_location(ctx.author.id) == None: return await ctx.respond("You do not have a default location set yet.\nEnter a location name and try again.", ephemeral=True)