allow you to mention dale-bot and he'll query wolfram

This commit is contained in:
Luke Robles 2023-10-26 11:45:15 -07:00
parent f93ee4a967
commit 035da8b152

View File

@ -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"))