JaBa/commands/General/invite.js

53 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Invite extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "invite",
dirname: __dirname,
2021-12-11 01:11:50 +05:00
enabled: false,
2021-12-10 21:39:54 +05:00
guildOnly: false,
2021-12-26 19:29:37 +05:00
aliases: ["i", "add", "vote"],
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: 1000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2022-01-04 00:35:11 +05:00
const inviteLink = this.client.generateInvite({
scopes: ["bot"],
permissions: [Discord.Permissions.FLAGS.ADMINISTRATOR]
});
2021-12-26 19:29:37 +05:00
const voteURL = `https://discordbots.org/bot/${this.client.user.id}/vote`;
const supportURL = await this.client.functions.supportLink(this.client);
2021-12-10 21:39:54 +05:00
2022-01-04 00:35:11 +05:00
if (args[0] && args[0] === "copy") return message.channel.send({
content: inviteLink
});
2021-12-10 21:39:54 +05:00
const embed = new Discord.MessageEmbed()
2022-01-04 00:35:11 +05:00
.setAuthor({
name: message.translate("general/invite:LINKS")
})
2021-12-26 19:29:37 +05:00
.setDescription(message.translate("general/invite:TIP", {
prefix: data.guild.prefix || ""
}))
2021-12-10 21:39:54 +05:00
.addField(message.translate("general/invite:ADD"), inviteLink)
.addField(message.translate("general/invite:VOTE"), voteURL)
.addField(message.translate("general/invite:SUPPORT"), supportURL)
.setColor(data.config.embed.color)
2022-01-04 00:35:11 +05:00
.setFooter({
text: data.config.embed.footer
});
2021-12-10 21:39:54 +05:00
2022-01-04 00:35:11 +05:00
message.channel.send({
embeds: [embed]
});
2021-12-10 21:39:54 +05:00
}
};
module.exports = Invite;