mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-23 05:34:58 +05:00
c76bfc3664
Команда emoji Мелкие правки Бот отвечает на команду, а не пишет в тот же канал
54 lines
No EOL
1.2 KiB
JavaScript
54 lines
No EOL
1.2 KiB
JavaScript
const Command = require("../../base/Command"),
|
|
Discord = require("discord.js"),
|
|
fetch = require("node-fetch");
|
|
|
|
class Hastebin extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: "hastebin",
|
|
dirname: __dirname,
|
|
enabled: true,
|
|
guildOnly: false,
|
|
aliases: ["hb"],
|
|
memberPermissions: [],
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
nsfw: false,
|
|
ownerOnly: false,
|
|
cooldown: 1000
|
|
});
|
|
}
|
|
|
|
async run(message, args, data) {
|
|
const content = args.join(" ");
|
|
if (!content) return message.error("general/hastebin:MISSING_TEXT");
|
|
|
|
try {
|
|
const res = await fetch("https://hastebin.com/documents", {
|
|
method: "POST",
|
|
body: content,
|
|
headers: {
|
|
"Content-Type": "text/plain"
|
|
}
|
|
});
|
|
|
|
const json = await res.json();
|
|
if (!json.key) return message.error("misc:ERR_OCCURRED");
|
|
|
|
const url = `https://hastebin.com/${json.key}.js`;
|
|
|
|
const embed = new Discord.MessageEmbed()
|
|
.setAuthor({
|
|
name: message.translate("general/hastebin:SUCCESS")
|
|
})
|
|
.setDescription(url)
|
|
.setColor(data.config.embed.color);
|
|
message.reply({
|
|
embeds: [embed]
|
|
});
|
|
} catch (e) {
|
|
message.error("misc:ERR_OCCURRED");
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = Hastebin; |