Convert wolfram to a slash command
This commit is contained in:
parent
d63ee287c3
commit
5321de9231
@ -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),
|
||||
)
|
||||
|
||||
|
@ -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):
|
||||
|
||||
|
@ -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"],
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user