aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/math.py
diff options
context:
space:
mode:
authorSamlonDev <stankiewiczgracjan2019@gmail.com>2025-06-14 18:54:02 +0200
committerSamlonDev <stankiewiczgracjan2019@gmail.com>2025-06-14 18:54:02 +0200
commit791e75cb2beeca45a6edf52b65f7e299e03b5eaf (patch)
treecfee93211b7f8ac1c985325aaf8d9399b7a357ca /cogs/math.py
parenttemp downloads the files instead (diff)
downloadsenator-sperma-791e75cb2beeca45a6edf52b65f7e299e03b5eaf.tar.gz
senator-sperma-791e75cb2beeca45a6edf52b65f7e299e03b5eaf.zip
code-style issues
Diffstat (limited to '')
-rw-r--r--cogs/math.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/cogs/math.py b/cogs/math.py
index df2be4a..53340f2 100644
--- a/cogs/math.py
+++ b/cogs/math.py
@@ -1,23 +1,25 @@
1from discord.ext import commands
2import discord
3from discord import (ApplicationContext)
4import subprocess 1import subprocess
5 2
3from discord import (ApplicationContext)
4from discord.ext import commands
5
6
6class Math(commands.Cog): 7class Math(commands.Cog):
7 def __init__(self, bot): 8 def __init__(self, bot):
8 self.bot = bot 9 self.bot = bot
9 10
10 @commands.slash_command( 11 @commands.slash_command(
11 name="math", 12 name="math",
12 description="wrug szyskih matfisuf" 13 description="wrug szyskih matfisuf"
13 ) 14 )
14 async def math(self, ctx:ApplicationContext, equation:str): 15 async def math(self, ctx: ApplicationContext, equation: str):
15 try: 16 try:
16 math=subprocess.check_output(f"qalc -e {equation}", shell=True) 17 math = subprocess.check_output(f"qalc -e {equation}", shell=True)
17 await ctx.respond(f"{equation} = {math.decode('utf-8').strip()}") 18 await ctx.respond(f"{equation} = {math.decode('utf-8').strip()}")
18 except Exception as e: 19 except Exception as e:
19 await ctx.respond(e, ephemeral=True) 20 await ctx.respond(e, ephemeral=True)
20 print(e) 21 print(e)
21 22
23
22def setup(bot): 24def setup(bot):
23 bot.add_cog(Math(bot)) \ No newline at end of file 25 bot.add_cog(Math(bot))