goat
command
pastebin
Upload command code
2
views
0
likes
2
installs
Aliases: bin
raw source
const axios = require("axios");
const fs = require("fs");
const path = require("path");
module.exports = {
config: {
name: "pastebin",
aliases: ["bin"],
version: "3.0.0",
author: "๐๐๐๐ฎ๐
",
countDown: 5,
role: 0,
shortDescription: "Upload command code",
category: "tool",
guide: "{pn} <commandName>"
},
onStart: async function ({ api, event, args }) {
const name = args[0];
if (!name) {
return api.sendMessage(
"โ Please provide a command name.",
event.threadID,
event.messageID
);
}
const file = path.join(__dirname, `${name}.js`);
if (!fs.existsSync(file)) {
return api.sendMessage(
`โ Command "${name}.js" not found.`,
event.threadID,
event.messageID
);
}
try {
const code = fs.readFileSync(file, "utf8");
const { data } = await axios.post(
"https://pastebin-xyz.vercel.app/api/paste",
{
content: code,
title: `${name}.js`
}
);
if (!data?.success || !data?.raw) {
return api.sendMessage(
"โ Failed to upload code.",
event.threadID,
event.messageID
);
}
return api.sendMessage(
`โญโโ ๐๐๐ฌ๐ญ๐๐๐ข๐ง
โ
โโโค ๐ ๐
๐ข๐ฅ๐ : ${name}.js
โโโค ๐ ๐๐ข๐ง๐ค : ${data.raw}
โ
โฐโโ ๐๐๐ซ๐ฎ๐'๐ฌ ๐๐จ๐ญ`,
event.threadID,
event.messageID
);
} catch (error) {
return api.sendMessage(
"โ Failed to connect to Pastebin API.",
event.threadID,
event.messageID
);
}
}
};