diff --git a/cogs/maths.py b/cogs/maths.py index 994b131c..6febeaa7 100644 --- a/cogs/maths.py +++ b/cogs/maths.py @@ -11,6 +11,8 @@ class Maths(commands.Cog): def __init__(self, bot): self.bot = bot + area = commands.SlashCommandGroup("area", "Find area of different figures.") + @commands.slash_command( name="squareroot", description="Finds the square root of any positive number" @@ -26,8 +28,8 @@ async def squareroot(self, ctx: ApplicationContext, number: int): localembed.set_footer(text=f"√({number}) = {result}") await ctx.respond(embed=localembed) - @commands.slash_command( - name="area_square", + @area.slash_command( + name="square", description="Finds the area of a square" ) @option(name="length", description="What is the length of one side?", type=int) @@ -38,8 +40,8 @@ async def area_square(self, ctx: ApplicationContext, length: int): localembed.set_footer(text=f"A = s²\n{length} x {length} = {result} sq. units") await ctx.respond(embed=localembed) - @commands.slash_command( - name="area_rectangle", + @area.slash_command( + name="rectangle", description="Finds the area of a rectangle" ) @option(name="length", description="What is the length?", type=int) @@ -52,8 +54,8 @@ async def area_rectangle(self, ctx: ApplicationContext, length: int, breadth: in localembed.set_footer(text=f"A = l x b\n{length} x {breadth} = {result} sq. units") await ctx.respond(embed=localembed) - @commands.slash_command( - name="area_circle", + @area.slash_command( + name="circle", description="Finds the area of a circle" ) @option(name="radius", description="What is the radius of the circle?", type=int) @@ -64,8 +66,8 @@ async def area_circle(self, ctx: ApplicationContext, radius: int): localembed.set_footer(text=f"Taking π as 22/7\nA = πr²\nπ x {radius}² = {result} sq. units") await ctx.respond(embed=localembed) - @commands.slash_command( - name="area_triangle", + @area.slash_command( + name="triangle", 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) diff --git a/config/commands.json b/config/commands.json index a514f78a..501754c4 100644 --- a/config/commands.json +++ b/config/commands.json @@ -569,7 +569,7 @@ "disabled": false, "bugged": false }, - "area_square": { + "area square": { "name": "Square Area ", "description": "Finds the area of a square.", "type": "maths", @@ -579,7 +579,7 @@ "disabled": false, "bugged": false }, - "area_rectangle": { + "area rectangle": { "name": "Rectangle Area", "description": "Finds the area of a rectangle.", "type": "maths", @@ -589,7 +589,7 @@ "disabled": false, "bugged": false }, - "area_circle": { + "area circle": { "name": "Circle Area", "description": "Finds the area of a circle. (Takes π as 22/7)", "type": "maths", @@ -599,7 +599,7 @@ "disabled": false, "bugged": false }, - "area_triangle": { + "area triangle": { "name": "Triangle Area", "description": "Finds the area of a triangle. (Uses Heron's formula)", "type": "maths",