misc: fix wolfram
This commit is contained in:
parent
67db6a0173
commit
3822efc744
1 changed files with 6 additions and 11 deletions
|
@ -74,22 +74,17 @@ wolfram.category = CATEGORY;
|
|||
wolfram.helpText = "Search YouTube and take the first result.";
|
||||
wolfram.usage = "<-v> [query]";
|
||||
wolfram.addAlias("wa");
|
||||
wolfram.callback = async function (msg, line, verboseFlag, _query) {
|
||||
wolfram.callback = async function (msg, line) {
|
||||
let verbose = false;
|
||||
|
||||
let query = _query;
|
||||
|
||||
if (verboseFlag == "-v" && _query) {
|
||||
if (line.includes("-v")) {
|
||||
line = line.replace("-v", "").trim();
|
||||
verbose = true;
|
||||
}
|
||||
|
||||
if (!_query) {
|
||||
query = verboseFlag;
|
||||
}
|
||||
|
||||
const req = await fetch(
|
||||
`http://api.wolframalpha.com/v2/query?input=${encodeURIComponent(
|
||||
query
|
||||
line
|
||||
)}&appid=LH2K8H-T3QKETAGT3&output=json`
|
||||
).then((x) => x.json());
|
||||
|
||||
|
@ -102,7 +97,7 @@ wolfram.callback = async function (msg, line, verboseFlag, _query) {
|
|||
|
||||
if (verbose) {
|
||||
const embed = {
|
||||
title: `Result for: \`${safeString(query)}\``,
|
||||
title: `Result for: \`${safeString(line)}\``,
|
||||
color: getTopColor(msg, hf.bot.user.id, pastelize(hf.bot.user.id)),
|
||||
fields: [],
|
||||
footer: {
|
||||
|
@ -129,7 +124,7 @@ wolfram.callback = async function (msg, line, verboseFlag, _query) {
|
|||
|
||||
return {embed};
|
||||
} else {
|
||||
return `\`${safeString(query)}\` -> ${
|
||||
return `\`${safeString(line)}\` -> ${
|
||||
data[1].subpods[0].plaintext.length > 0
|
||||
? safeString(data[1].subpods[0].plaintext)
|
||||
: data[1].subpods[0].img.src
|
||||
|
|
Loading…
Reference in a new issue