from discord.ext import commands import discord from discord import (ApplicationContext) import subprocess class Math(commands.Cog): def __init__(self, bot): self.bot = bot @commands.slash_command( name="math", description="wrug szyskih matfisuf" ) async def math(self, ctx:ApplicationContext, equation:str): try: math=subprocess.check_output(f"qalc -e {equation}", shell=True) await ctx.respond(f"{equation} = {math.decode('utf-8').strip()}") except Exception as e: await ctx.respond(e, ephemeral=True) print(e) def setup(bot): bot.add_cog(Math(bot))