misc.wolfram: line -> query

This commit is contained in:
Cynthia Foxwell 2022-11-29 19:40:59 -07:00
parent 9d1ff77b11
commit 295a04a4fa

View file

@ -81,7 +81,7 @@ wolfram.callback = async function (msg, line, [query], {verbose, v}) {
const req = await fetch( const req = await fetch(
`http://api.wolframalpha.com/v2/query?input=${encodeURIComponent( `http://api.wolframalpha.com/v2/query?input=${encodeURIComponent(
line query
)}&appid=LH2K8H-T3QKETAGT3&output=json` )}&appid=LH2K8H-T3QKETAGT3&output=json`
).then((x) => x.json()); ).then((x) => x.json());
@ -94,7 +94,7 @@ wolfram.callback = async function (msg, line, [query], {verbose, v}) {
if (_verbose) { if (_verbose) {
const embed = { const embed = {
title: `Result for: \`${safeString(line)}\``, title: `Result for: \`${safeString(query)}\``,
fields: [], fields: [],
footer: { footer: {
icon_url: "http://www.wolframalpha.com/share.png", icon_url: "http://www.wolframalpha.com/share.png",
@ -137,11 +137,11 @@ wolfram.callback = async function (msg, line, [query], {verbose, v}) {
if (data[1].subpods[0].plaintext.length > 0) if (data[1].subpods[0].plaintext.length > 0)
string = safeString(data[1].subpods[0].plaintext); string = safeString(data[1].subpods[0].plaintext);
if (string.length > 2000 - (6 + safeString(line).length)) if (string.length > 2000 - (6 + safeString(query).length))
string = "Output too long: " + (await hastebin(string)); string = "Output too long: " + (await hastebin(string));
return { return {
content: `\`${safeString(line)}\` -> ${string.length > 0 ? string : ""}`, content: `\`${safeString(query)}\` -> ${string.length > 0 ? string : ""}`,
file: image && { file: image && {
file: image, file: image,
name: "wolfram_output.gif", name: "wolfram_output.gif",