diff options
| author | SamlonDev <stankiewiczgracjan2019@gmail.com> | 2025-06-14 18:54:02 +0200 |
|---|---|---|
| committer | SamlonDev <stankiewiczgracjan2019@gmail.com> | 2025-06-14 18:54:02 +0200 |
| commit | 791e75cb2beeca45a6edf52b65f7e299e03b5eaf (patch) | |
| tree | cfee93211b7f8ac1c985325aaf8d9399b7a357ca /cogs/math.py | |
| parent | temp downloads the files instead (diff) | |
| download | senator-sperma-791e75cb2beeca45a6edf52b65f7e299e03b5eaf.tar.gz senator-sperma-791e75cb2beeca45a6edf52b65f7e299e03b5eaf.zip | |
code-style issues
Diffstat (limited to 'cogs/math.py')
| -rw-r--r-- | cogs/math.py | 16 |
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 @@ | |||
| 1 | from discord.ext import commands | ||
| 2 | import discord | ||
| 3 | from discord import (ApplicationContext) | ||
| 4 | import subprocess | 1 | import subprocess |
| 5 | 2 | ||
| 3 | from discord import (ApplicationContext) | ||
| 4 | from discord.ext import commands | ||
| 5 | |||
| 6 | |||
| 6 | class Math(commands.Cog): | 7 | class 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 | |||
| 22 | def setup(bot): | 24 | def setup(bot): |
| 23 | bot.add_cog(Math(bot)) \ No newline at end of file | 25 | bot.add_cog(Math(bot)) |
