2021-12-10 21:39:54 +05:00
|
|
|
const Command = require("../../base/Command.js"),
|
|
|
|
Discord = require("discord.js");
|
|
|
|
|
|
|
|
class Qrcode extends Command {
|
|
|
|
constructor (client) {
|
|
|
|
super(client, {
|
|
|
|
name: "qrcode",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: false,
|
|
|
|
aliases: [ "qr" ],
|
|
|
|
memberPermissions: [],
|
|
|
|
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 3000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run (message, args, data) {
|
|
|
|
const text = args.join(" ");
|
2021-12-11 01:11:50 +05:00
|
|
|
if (!text) return message.error("images/qrcode:MISSING_TEXT");
|
|
|
|
|
|
|
|
const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, { prefixEmoji: "loading" });
|
|
|
|
|
2021-12-10 21:39:54 +05:00
|
|
|
const embed = new Discord.MessageEmbed()
|
|
|
|
.setImage(`https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${text.replace(new RegExp(" ", "g"), "%20")}`)
|
|
|
|
.setColor(data.config.embed.color);
|
|
|
|
|
|
|
|
pleaseWait.edit(message.translate("images/qrcode:SUCCESS"), { embed });
|
|
|
|
}
|
2021-12-11 01:11:50 +05:00
|
|
|
};
|
2021-12-10 21:39:54 +05:00
|
|
|
|
|
|
|
module.exports = Qrcode;
|