Added webhook client
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle } = require('discord.js');
|
const { SlashCommandBuilder, PermissionFlagsBits, ButtonBuilder, ActionRowBuilder, ButtonStyle, EmbedBuilder, WebhookClient } = require('discord.js');
|
||||||
const { color } = require('../config/options.json');
|
const { color } = require('../config/options.json');
|
||||||
|
const guildInfo = "https://discord.com/api/webhooks/1085959273202327592/oz2k_poWnLbuAB8JZ0K_Sl8WaD2Hv3kUvTMSHZKVZNPED-kL1YU2hHJpOcRHa4RaHP8V"
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'config',
|
name: 'config',
|
||||||
@@ -12,17 +13,31 @@ module.exports = {
|
|||||||
.addSubcommand(subcommand =>
|
.addSubcommand(subcommand =>
|
||||||
subcommand
|
subcommand
|
||||||
.setName('sendapplication')
|
.setName('sendapplication')
|
||||||
.setDescription('Configure the send application command.')
|
.setDescription('Send the application message to a channel.')
|
||||||
.addChannelOption(option =>
|
.addChannelOption(option =>
|
||||||
option
|
option
|
||||||
.setName('channel')
|
.setName('channel')
|
||||||
.setDescription('The channel to send the application to.')
|
.setDescription('The channel to send the application to.')
|
||||||
.setRequired(true)))
|
.setRequired(true)))
|
||||||
|
.addSubcommand(subcommand =>
|
||||||
|
subcommand
|
||||||
|
.setName('sendguildinfo')
|
||||||
|
.setDescription('Send the guild info message to a channel.'))
|
||||||
|
.addSubcommand(subcommand =>
|
||||||
|
subcommand
|
||||||
|
.setName('sendrequirements')
|
||||||
|
.setDescription('Send the guild requirements message to a channel.'))
|
||||||
|
.addSubcommand(subcommand =>
|
||||||
|
subcommand
|
||||||
|
.setName('sendrules-info')
|
||||||
|
.setDescription('Send the rules and info message to a channel.'))
|
||||||
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
||||||
.setDMPermission(false),
|
.setDMPermission(false),
|
||||||
|
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
|
|
||||||
|
const user = interaction.user;
|
||||||
|
const guild = interaction.guild;
|
||||||
const subcommand = interaction.options.getSubcommand();
|
const subcommand = interaction.options.getSubcommand();
|
||||||
const embedColor = Number(color.replace("#", "0x"));
|
const embedColor = Number(color.replace("#", "0x"));
|
||||||
|
|
||||||
@@ -58,6 +73,31 @@ module.exports = {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
if (subcommand === "sendguildinfo") {
|
||||||
|
|
||||||
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
|
const webhookCient = new WebhookClient({ url: guildInfo });
|
||||||
|
|
||||||
|
await webhookCient.send({
|
||||||
|
content: 'Guild Info',
|
||||||
|
username: guild.name,
|
||||||
|
avatarURL: guild.iconURL({ dynamic: true }),
|
||||||
|
embeds: [{
|
||||||
|
title: 'Guild Info',
|
||||||
|
description: 'This is the guild info message.',
|
||||||
|
color: embedColor,
|
||||||
|
footer: {
|
||||||
|
text: interaction.guild.name + " | Developed by @Taken#0002",
|
||||||
|
iconURL: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
},
|
||||||
|
thumbnail: {
|
||||||
|
url: interaction.guild.iconURL({ dynamic: true })
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
|
await interaction.editReply({ content: 'Message sent', ephemeral: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user