allow you to mention dale-bot and he'll query wolfram
This commit is contained in:
parent
1cb34c2989
commit
3a18c03ddc
15
app/bot.py
15
app/bot.py
@ -133,4 +133,19 @@ async def fix_tiktok_links(ctx):
|
|||||||
return
|
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"))
|
bot.run(os.getenv("discord_token"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user