diff --git a/app/cogs/actual_utils.py b/app/cogs/actual_utils.py index 11a9d836..8a9e1d73 100644 --- a/app/cogs/actual_utils.py +++ b/app/cogs/actual_utils.py @@ -59,11 +59,19 @@ class ActualUtils(commands.Cog): await ctx.message.delete() os.remove(file_path) - @commands.command(name="ask", aliases=["wolfram"]) - async def ask(self, ctx: commands.Context, *, query): + @commands.slash_command( + guild_ids=None, name="wolfram", description="Send a query to wolfram alpha" + ) + @option( + name="query", + required=True, + description="The query you want to pass to wolfram alpha", + ) + async def ask(self, ctx, query): import questions - await ctx.reply( + await ctx.defer() + await ctx.send_followup( questions.answer_question(query), ) diff --git a/app/cogs/server_utils.py b/app/cogs/server_utils.py index e3770329..2305ce5a 100644 --- a/app/cogs/server_utils.py +++ b/app/cogs/server_utils.py @@ -66,28 +66,6 @@ class ServerUtils(commands.Cog): os.remove(emoji_staging) return - @commands.command() - @commands.has_permissions(administrator=True) - async def timeout( - self, - ctx: commands.Context, - member: discord.Member = None, - time=None, - *, - reason=None, - ): - import humanfriendly - import datetime - - time = humanfriendly.parse_timespan(time) - await member.timeout( - until=discord.utils.utcnow() + datetime.timedelta(seconds=time) - ) - await member.send( - "You have been timed out for %s seconds for %s" % (time, reason) - ) - await ctx.send("Timed %s out for %s seconds" % (member.mention, time)) - @commands.command(name="oncall") async def oncall(self, ctx: commands.Context): diff --git a/app/help_methods.py b/app/help_methods.py index 4684f419..8249acbb 100644 --- a/app/help_methods.py +++ b/app/help_methods.py @@ -15,9 +15,9 @@ def get_help_message(method): "Ask dale bot a question and it will give you an 8ball response", "\nUsage: !8ball Will I win the lottery tomorrow?", ], - "ask": [ - "Submits your query to wolfram alpha. If that cannot be answered, tries wikipedia\n", - "\nUsage: !ask 100lbs to KG", + "wolfram": [ + "Submits your query to wolfram alpha.\n", + "\nUsage: !wolfram 100lbs to KG", ], "avatar": [ "Returns the avatar for the mentioned user", @@ -262,7 +262,6 @@ def get_help_embed(bot): ], "Utilities": [ "8ball", - "ask", "corona", "decide", "emoji", @@ -277,6 +276,7 @@ def get_help_embed(bot): "tts", "vc", "wallpaper", + "wolfram", "youtube", ], "user tools": ["help", "invite", "purge", "roles", "donate"], diff --git a/app/questions.py b/app/questions.py index a49be59e..9abf10d9 100755 --- a/app/questions.py +++ b/app/questions.py @@ -1,5 +1,4 @@ import os -import wikipedia import wolframalpha import help_methods @@ -18,10 +17,7 @@ def answer_question(message): res = client.query(message) return next(res.results).text except Exception: - try: - return wikipedia.summary(message, sentences=5) - except Exception: - return "Sorry, I'm unable to answer that" + return "Sorry, I'm unable to answer that" return help_methods.get_help_message("message") diff --git a/app/requirements.txt b/app/requirements.txt index 0a2a32c2..7aa51076 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,13 +1,12 @@ beautifulsoup4 cmagick +git+https://github.com/pycord-development/pycord@40d98dd7acff7ab97ec37cbc74603597975fb5f1 gTTS +httpx humanfriendly lxml +openai owotext pandas -git+https://github.com/pycord-development/pycord@40d98dd7acff7ab97ec37cbc74603597975fb5f1 requests -wikipedia -wolframalpha -openai -httpx \ No newline at end of file +wolframalpha \ No newline at end of file