JaBa/commands/Images/qrcode.js

40 lines
974 B
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Qrcode extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "qrcode",
dirname: __dirname,
enabled: true,
guildOnly: false,
2021-12-26 19:29:37 +05:00
aliases: ["qr"],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 3000
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-10 21:39:54 +05:00
const text = args.join(" ");
2021-12-11 01:11:50 +05:00
if (!text) return message.error("images/qrcode:MISSING_TEXT");
2021-12-26 19:29:37 +05:00
const pleaseWait = await message.sendT("misc:PLEASE_WAIT", null, {
prefixEmoji: "loading"
});
2021-12-11 01:11:50 +05:00
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);
2022-01-03 23:20:33 +05:00
pleaseWait.edit({
content: message.translate("images/qrcode:SUCCESS"),
embeds: [embed]
2021-12-26 19:29:37 +05:00
});
2022-01-03 23:20:33 +05:00
2021-12-10 21:39:54 +05:00
}
2021-12-11 01:11:50 +05:00
};
2021-12-10 21:39:54 +05:00
module.exports = Qrcode;