From b5543eec1105c8e1dbf70994fe3847bf37fa0f60 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Fri, 1 Apr 2022 20:07:15 -0600 Subject: [PATCH] move hastebin to nekobin --- src/lib/utils.js | 6 +++--- src/modules/bot.js | 8 ++++---- src/modules/misc.js | 4 +--- src/modules/utility.js | 4 +--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/lib/utils.js b/src/lib/utils.js index ddc2a6a..7259401 100644 --- a/src/lib/utils.js +++ b/src/lib/utils.js @@ -151,11 +151,11 @@ async function getImage(msg, str) { } async function hastebin(body) { - const res = await fetch(`${hf.config.haste_provider}/documents`, { + const res = await fetch(`https://nekobin.com/api/documents`, { method: "POST", - body, + JSON.stringify({content:body}), }).then((r) => r.json()); - return res.key; + return "https://nekobin.com"+res.result.key; } hf.selectionMessages = hf.selectionMessages || new Eris.Collection(); diff --git a/src/modules/bot.js b/src/modules/bot.js index 7006618..45c94f0 100644 --- a/src/modules/bot.js +++ b/src/modules/bot.js @@ -105,8 +105,8 @@ _eval.callback = async function (msg, line) { return ":warning: Output (errored):\n```js\n" + out + "\n```"; } else { if (out.toString().length > 1980) { - const code = await hastebin(out.toString()); - return `\u2705 Output too long to send in a message: ${hf.config.haste_provider}/${code}`; + const haste = await hastebin(out.toString()); + return `\u2705 Output too long to send in a message: ${haste}`; } else { return "\u2705 Output:\n```js\n" + out + "\n```"; } @@ -131,9 +131,9 @@ exec.callback = async function (msg, line) { proc.on("close", async (code) => { out += `====\nExited with ${code}`; if (out.length > 1980) { - const code = await hastebin(out); + const haste = await hastebin(out); msg.channel.createMessage({ - content: `Output too long to send in a message: ${hf.config.haste_provider}/${code}`, + content: `Output too long to send in a message: ${haste}`, allowedMentions: { repliedUser: false, }, diff --git a/src/modules/misc.js b/src/modules/misc.js index df26f59..683b45e 100644 --- a/src/modules/misc.js +++ b/src/modules/misc.js @@ -133,9 +133,7 @@ wolfram.callback = async function (msg, line) { string = safeString(data[1].subpods[0].plaintext); if (string.length > 2000 - (6 + safeString(line).length)) - string = - `Output too long: ${hf.config.haste_provider}/` + - (await hastebin(string)); + string = "Output too long: " + (await hastebin(string)); return { content: `\`${safeString(line)}\` -> ${string.length > 0 ? string : ""}`, diff --git a/src/modules/utility.js b/src/modules/utility.js index 0d17c37..6223eed 100644 --- a/src/modules/utility.js +++ b/src/modules/utility.js @@ -593,9 +593,7 @@ charinfo.callback = async function (msg, line) { .join("\n"); if (lines.length > 2000) { - return `Output too long: ${hf.config.haste_provider}/${await hastebin( - lines - )}`; + return "Output too long: " + (await hastebin(lines)); } else { return lines; }