feat(commands/administration): adding the welcome show command
This commit is contained in:
parent
0db6014b72
commit
7061a98373
1 changed files with 29 additions and 0 deletions
|
|
@ -12,7 +12,11 @@ import {
|
|||
ChannelSelectMenuInteraction,
|
||||
GuildBasedChannel,
|
||||
TextInputStyle,
|
||||
MessageComponentInteraction,
|
||||
CacheType,
|
||||
} from 'discord.js';
|
||||
import { channelMention, EmbedBuilder } from '@discordjs/builders';
|
||||
import { Guild as GuildPrisma } from '@prisma/client';
|
||||
import { prisma } from '@lib/prisma';
|
||||
import emoji from '../../../assets/emoji.json' assert { type: 'json' };
|
||||
|
||||
|
|
@ -49,10 +53,35 @@ export default {
|
|||
});
|
||||
return;
|
||||
}
|
||||
const guildData: GuildPrisma = await prisma.guild.findUnique({
|
||||
where: {
|
||||
id: interaction.guild.id,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const choice: string = interaction.options.getString('action', true);
|
||||
|
||||
switch (choice) {
|
||||
case 'welcome_show': {
|
||||
const status: EmbedBuilder = new EmbedBuilder()
|
||||
.setTitle(`Welcome status for ${interaction.guild.name}`)
|
||||
.setColor(guildData.color)
|
||||
.setFooter({
|
||||
text: guildData.footer,
|
||||
})
|
||||
.setDescription(`
|
||||
${guildData.joinEnabled ? `${emoji.config.enable}` : `${emoji.config.disable}`} **Join message:**
|
||||
${guildData.joinEnabled ? `> in ${channelMention(guildData.joinChannel)} with the message \`${guildData.joinMessage}\`\n` : ''}
|
||||
${guildData.leaveEnabled ? `${emoji.config.enable}` : `${emoji.config.disable}`} **Leave message:**
|
||||
${guildData.leaveEnabled ? `> in ${channelMention(guildData.joinChannel)} with the message \`${guildData.leaveMessage}\`` : ''}
|
||||
`);
|
||||
await interaction.reply({
|
||||
embeds: [status],
|
||||
flags: MessageFlags.Ephemeral,
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'welcome_join': {
|
||||
const joinSelectMenu: ChannelSelectMenuBuilder = new ChannelSelectMenuBuilder()
|
||||
.setCustomId('join_select_channel')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue