aboutsummaryrefslogtreecommitdiffstats
path: root/cogs/math.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--cogs/math.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/cogs/math.py b/cogs/math.py
new file mode 100644
index 0000000..80a6de9
--- /dev/null
+++ b/cogs/math.py
@@ -0,0 +1,26 @@
1from base64 import decode
2from codecs import utf_8_decode
3import string
4import discord
5from discord import (ApplicationContext)
6import subprocess
7
8class Math(commands.Cog):
9 def __init__(self, bot):
10 self.bot = bot
11
12 @commands.slash_command(
13 name="Math",
14 description="wrug szyskih matfisuf",
15
16 )
17 async def math(self, ctx:ApplicationContext, equation:string):
18 try:
19 math=subprocess.check_output(f"qalc -e {equation}", shell=True)
20 await ctx.respond(f"{equation} = {math.decode('utf-8').strip()}")
21 except Exception as e:
22 await ctx.respond(e, ephemeral=True)
23 print(e)
24
25def setup(bot):
26 bot.add_cog(Math(bot)) \ No newline at end of file