move hastebin to nekobin

This commit is contained in:
Cynthia Foxwell 2022-04-01 20:07:15 -06:00
parent 6388830efd
commit b5543eec11
4 changed files with 9 additions and 13 deletions

View File

@ -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();

View File

@ -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,
},

View File

@ -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 : ""}`,

View File

@ -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;
}