mirror of
https://github.com/aydenjahola/discord-multipurpose-bot.git
synced 2024-11-22 08:45:55 +00:00
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName("invite")
|
|
.setDescription("Provides an invite link to add the bot to your server."),
|
|
|
|
async execute(interaction, client) {
|
|
try {
|
|
const botInviteLink = `https://discord.com/oauth2/authorize?client_id=${client.user.id}&permissions=8&scope=bot%20applications.commands`;
|
|
|
|
const inviteEmbed = new EmbedBuilder()
|
|
.setColor("#0099ff")
|
|
.setTitle("Invite the Bot to Your Server!")
|
|
.setDescription(`**[Click here to invite the bot!](${botInviteLink})**`)
|
|
.setTimestamp()
|
|
.setFooter({
|
|
text: `Requested by ${interaction.user.tag}`,
|
|
iconURL: interaction.user.displayAvatarURL(),
|
|
});
|
|
|
|
await interaction.reply({
|
|
embeds: [inviteEmbed],
|
|
ephemeral: true,
|
|
});
|
|
} catch (error) {
|
|
console.error("Error executing the invite command:", error);
|
|
await interaction.reply({
|
|
content: "There was an error while executing this command!",
|
|
ephemeral: true,
|
|
});
|
|
}
|
|
},
|
|
};
|