Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions cogs/maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions config/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@
"disabled": false,
"bugged": false
},
"area_square": {
"area square": {
"name": "Square Area ",
"description": "Finds the area of a square.",
"type": "maths",
Expand All @@ -579,7 +579,7 @@
"disabled": false,
"bugged": false
},
"area_rectangle": {
"area rectangle": {
"name": "Rectangle Area",
"description": "Finds the area of a rectangle.",
"type": "maths",
Expand All @@ -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",
Expand All @@ -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",
Expand Down