move hastebin to nekobin
This commit is contained in:
		
							parent
							
								
									6388830efd
								
							
						
					
					
						commit
						b5543eec11
					
				
					 4 changed files with 9 additions and 13 deletions
				
			
		| 
						 | 
					@ -151,11 +151,11 @@ async function getImage(msg, str) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function hastebin(body) {
 | 
					async function hastebin(body) {
 | 
				
			||||||
  const res = await fetch(`${hf.config.haste_provider}/documents`, {
 | 
					  const res = await fetch(`https://nekobin.com/api/documents`, {
 | 
				
			||||||
    method: "POST",
 | 
					    method: "POST",
 | 
				
			||||||
    body,
 | 
					    JSON.stringify({content:body}),
 | 
				
			||||||
  }).then((r) => r.json());
 | 
					  }).then((r) => r.json());
 | 
				
			||||||
  return res.key;
 | 
					  return "https://nekobin.com"+res.result.key;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
hf.selectionMessages = hf.selectionMessages || new Eris.Collection();
 | 
					hf.selectionMessages = hf.selectionMessages || new Eris.Collection();
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -105,8 +105,8 @@ _eval.callback = async function (msg, line) {
 | 
				
			||||||
    return ":warning: Output (errored):\n```js\n" + out + "\n```";
 | 
					    return ":warning: Output (errored):\n```js\n" + out + "\n```";
 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    if (out.toString().length > 1980) {
 | 
					    if (out.toString().length > 1980) {
 | 
				
			||||||
      const code = await hastebin(out.toString());
 | 
					      const haste = await hastebin(out.toString());
 | 
				
			||||||
      return `\u2705 Output too long to send in a message: ${hf.config.haste_provider}/${code}`;
 | 
					      return `\u2705 Output too long to send in a message: ${haste}`;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      return "\u2705 Output:\n```js\n" + out + "\n```";
 | 
					      return "\u2705 Output:\n```js\n" + out + "\n```";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					@ -131,9 +131,9 @@ exec.callback = async function (msg, line) {
 | 
				
			||||||
  proc.on("close", async (code) => {
 | 
					  proc.on("close", async (code) => {
 | 
				
			||||||
    out += `====\nExited with ${code}`;
 | 
					    out += `====\nExited with ${code}`;
 | 
				
			||||||
    if (out.length > 1980) {
 | 
					    if (out.length > 1980) {
 | 
				
			||||||
      const code = await hastebin(out);
 | 
					      const haste = await hastebin(out);
 | 
				
			||||||
      msg.channel.createMessage({
 | 
					      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: {
 | 
					        allowedMentions: {
 | 
				
			||||||
          repliedUser: false,
 | 
					          repliedUser: false,
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -133,9 +133,7 @@ wolfram.callback = async function (msg, line) {
 | 
				
			||||||
      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(line).length))
 | 
				
			||||||
      string =
 | 
					      string = "Output too long: " + (await hastebin(string));
 | 
				
			||||||
        `Output too long: ${hf.config.haste_provider}/` +
 | 
					 | 
				
			||||||
        (await hastebin(string));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return {
 | 
					    return {
 | 
				
			||||||
      content: `\`${safeString(line)}\` -> ${string.length > 0 ? string : ""}`,
 | 
					      content: `\`${safeString(line)}\` -> ${string.length > 0 ? string : ""}`,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -593,9 +593,7 @@ charinfo.callback = async function (msg, line) {
 | 
				
			||||||
    .join("\n");
 | 
					    .join("\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (lines.length > 2000) {
 | 
					  if (lines.length > 2000) {
 | 
				
			||||||
    return `Output too long: ${hf.config.haste_provider}/${await hastebin(
 | 
					    return "Output too long: " + (await hastebin(lines));
 | 
				
			||||||
      lines
 | 
					 | 
				
			||||||
    )}`;
 | 
					 | 
				
			||||||
  } else {
 | 
					  } else {
 | 
				
			||||||
    return lines;
 | 
					    return lines;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue