aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamlonDev <stankiewiczgracjan2019@gmail.com>2025-05-26 16:26:41 +0200
committerSamlonDev <stankiewiczgracjan2019@gmail.com>2025-05-26 16:26:41 +0200
commitd3f2293e49a8524fa48cf86736c9d5fb92dc39bd (patch)
tree64f6a503847908148af843f2612ca13e392d9b77
parentuse python yt-dlp instead of shell (diff)
downloadsenator-sperma-d3f2293e49a8524fa48cf86736c9d5fb92dc39bd.tar.gz
senator-sperma-d3f2293e49a8524fa48cf86736c9d5fb92dc39bd.zip
add math using qalc
-rw-r--r--cogs/math.py26
-rw-r--r--main.py1
2 files changed, 27 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
diff --git a/main.py b/main.py
index 9a9acd9..e21ec66 100644
--- a/main.py
+++ b/main.py
@@ -21,6 +21,7 @@ if __name__ == "__main__":
21 'cogs.tts', 21 'cogs.tts',
22 'cogs.web', 22 'cogs.web',
23 'cogs.ai', 23 'cogs.ai',
24 'cogs.math',
24 'cogs.downloader', 25 'cogs.downloader',
25 'cogs.music.play', 26 'cogs.music.play',
26 'cogs.music.play_compressed', 27 'cogs.music.play_compressed',