Skip to content
Merged
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
26 changes: 13 additions & 13 deletions cogs/maths.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# Commands
class Maths(commands.Cog):
def __init__(self, bot): self.bot = bot
area = SlashCommandGroup("area", "Find area of different figures.")

math = SlashCommandGroup("math", "Use various math tools.")

@commands.slash_command(
name="squareroot",
Expand All @@ -30,9 +30,9 @@ async def squareroot(self, ctx: ApplicationContext, number: int):
localembed = discord.Embed(title=f"Square root of {number}", description=result, color=color)
localembed.set_footer(text=f"√({number}) = {result}")
await ctx.respond(embed=localembed)
@area.command(
name="square",

@math.command(
name="area_square",
description="Finds the area of a square"
)
@option(name="length", description="What is the length of one side?", type=int)
Expand All @@ -42,9 +42,9 @@ async def area_square(self, ctx: ApplicationContext, length: int):
localembed = discord.Embed(title=f"Area of square of side {length} units", description=f"{result} sq. units", color=color)
localembed.set_footer(text=f"A = s²\n{length} x {length} = {result} sq. units")
await ctx.respond(embed=localembed)
@area.command(
name="rectangle",

@math.command(
name="area_rectangle",
description="Finds the area of a rectangle"
)
@option(name="length", description="What is the length?", type=int)
Expand All @@ -57,8 +57,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)

@area.command(
name="circle",
@math.command(
name="area_circle",
description="Finds the area of a circle"
)
@option(name="radius", description="What is the radius of the circle?", type=int)
Expand All @@ -73,9 +73,9 @@ async def area_circle(self, ctx: ApplicationContext, radius: int, pi: str = "22/
elif pi == "3.14": localembed.set_footer(text=f"Taking π as 3.14\nA = πr²\nπ x {radius}² = {result} sq. units")
elif pi == "3":localembed.set_footer(text=f"Taking π as 3\nA = πr²\nπ x {radius}² = {result} sq. units")
await ctx.respond(embed=localembed)
@area.command(
name="triangle",

@math.command(
name="area_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