allow you to mention dale-bot and he'll query wolfram
This commit is contained in:
parent
f93ee4a967
commit
035da8b152
15
app/bot.py
15
app/bot.py
@ -133,4 +133,19 @@ async def fix_tiktok_links(ctx):
|
||||
return
|
||||
|
||||
|
||||
@bot.event
|
||||
async def on_message(ctx):
|
||||
if str(bot.user.id) in ctx.content:
|
||||
import wolframalpha
|
||||
|
||||
client = wolframalpha.Client(os.getenv("wolfram_token"))
|
||||
query = " ".join(ctx.content.split()[1:])
|
||||
try:
|
||||
res = client.query(query)
|
||||
return await ctx.reply(next(res.results).text)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return await ctx.reply("Sorry, I'm unable to answer that")
|
||||
|
||||
|
||||
bot.run(os.getenv("discord_token"))
|
||||
|
Loading…
x
Reference in New Issue
Block a user