Skip to content

Commit

Permalink
Update mod application modal to submit to the correct location based …
Browse files Browse the repository at this point in the history
…on the role being applied to & update embedded message to show the role.
  • Loading branch information
SuperMarioDaBom committed Dec 12, 2024
1 parent 1a6927f commit 708b24c
Showing 1 changed file with 40 additions and 3 deletions.
43 changes: 40 additions & 3 deletions src/modals/mod-application.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ async function modApplicationHandler(interaction) {
ephemeral: true
});

const modType = interaction.customId.split('-').pop();
const experience = interaction.fields.getTextInputValue('experience');
const timezone = interaction.fields.getTextInputValue('timezone');
const availablity = interaction.fields.getTextInputValue('availablity');
Expand All @@ -72,7 +73,26 @@ async function modApplicationHandler(interaction) {
const applyingMember = await interaction.member.fetch();
const guild = await interaction.guild.fetch();

const channelId = await database.getGuildSetting(interaction.guildId, 'mod_applications_channel_id');
var selectedDBItem = '';
switch(modType) {
case 'discord':
selectedDBItem = 'mod_applications_channel_id';
break;
case 'vc':
selectedDBItem = 'vc_mod_apps_channel_id';
break;
case 'forum':
selectedDBItem = 'forum_mod_apps_channel_id';
break;
case 'network':
selectedDBItem = 'network_mod_apps_channel_id';
break;
case 'juxt':
selectedDBItem = 'juxt_mod_apps_channel_id';
break;
}

const channelId = await database.getGuildSetting(interaction.guildId, selectedDBItem);
const channel = channelId && await guild.channels.fetch(channelId);

if (!channel) {
Expand All @@ -82,8 +102,25 @@ async function modApplicationHandler(interaction) {
const modApplicationEmbed = new Discord.EmbedBuilder();

modApplicationEmbed.setColor(0x9D6FF3);
modApplicationEmbed.setTitle('Mod Application');
modApplicationEmbed.setDescription(`<@${applyingMember.user.id}> has submitted a moderator application`);

switch(modType) {
case 'discord':
modApplicationEmbed.setTitle('Discord Mod Application');
break;
case 'vc':
modApplicationEmbed.setTitle('VC Mod Application');
break;
case 'forum':
modApplicationEmbed.setTitle('Forum Mod Application');
break;
case 'network':
modApplicationEmbed.setTitle('Network Mod Application');
break;
case 'juxt':
modApplicationEmbed.setTitle('Juxt Mod Application');
break;
}
modApplicationEmbed.setDescription(`<@${applyingMember.user.id}> has submitted a ${modType} moderator application`);
modApplicationEmbed.setImage('attachment://pending-banner.png');
modApplicationEmbed.setThumbnail('attachment://pending-icon.png');
modApplicationEmbed.setAuthor({
Expand Down

0 comments on commit 708b24c

Please sign in to comment.