diff --git a/.env.example b/.env.example index d0e4a98..6a3f672 100644 --- a/.env.example +++ b/.env.example @@ -4,6 +4,7 @@ SERVER_ID= SAY_LOGS_CHANNEL= LOGS_CHANNEL= SIMULATED_BAN_SHARE_LOGS_CHANNEL= +BAN_LOGS_CHANNEL= # These arent needed outside of production MAVEN_REPO= diff --git a/src/logIssueAnalyzers/optifine.ts b/src/logIssueAnalyzers/optifine.ts index 70d69ca..32cb32e 100644 --- a/src/logIssueAnalyzers/optifine.ts +++ b/src/logIssueAnalyzers/optifine.ts @@ -9,7 +9,7 @@ export const optifineAnalyzer: Analyzer = async (log) => { if (matchesOptifine?.[1] == 'true') { return { name: 'Optifine Warning Disabled', - value: 'You appeared to have disabled the Optifine warning. Many issues you might encounter are caused by Optifine. You will most likely get any support due to this.', + value: 'You appeared to have disabled the Optifine warning. Many issues you might encounter are caused by Optifine. You will not get any support due to this.', }; } else { return { diff --git a/src/types/environment.d.ts b/src/types/environment.d.ts index 74cff88..37bd4b2 100644 --- a/src/types/environment.d.ts +++ b/src/types/environment.d.ts @@ -7,6 +7,7 @@ declare global { SERVER_ID: string; SAY_LOGS_CHANNEL: string; LOGS_CHANNEL: string; + BAN_LOGS_CHANNEL: string; MAVEN_REPO: string; GITHUB_STATUS_CHANNEL: string; GITHUB_SECRET: string; diff --git a/src/webserver/banshare.ts b/src/webserver/banshare.ts index 9187144..c1d1146 100644 --- a/src/webserver/banshare.ts +++ b/src/webserver/banshare.ts @@ -16,7 +16,7 @@ const banButton = new Button( 'ban', async (interaction, data: { userId: string }) => { const reason = - 'aero banshare: ' + + 'simulated banshare: ' + (interaction.message.embeds[0].fields[3].value ?? 'no reason provided'); const modal = new ModalBuilder() @@ -30,20 +30,58 @@ const banButton = new Button( .setValue(reason) ) ); - interaction.showModal(modal); + await interaction.showModal(modal); interaction .awaitModalSubmit({ filter: (interaction) => interaction.customId == modal.data.custom_id, time: 300_000, }) - .then((modalResponse) => { + .then(async (modalResponse) => { interaction.guild?.bans.create(data.userId, { reason: modalResponse.components[0].components[0].value, }); - interaction.reply( - `<@${data.userId}> (\`${data.userId}\`) was banned.` - ); + await interaction.reply({ + content: `<@${data.userId}> (\`${data.userId}\`) was banned.`, + ephemeral: true, + }); + await interaction.update({ + components: [ + new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setLabel('ban') + .setStyle(ButtonStyle.Danger) + .setDisabled(true) + ), + ], + }); + if (interaction.guild != null) { + const channel = await interaction.guild.channels.fetch( + process.env.BAN_LOGS_CHANNEL + ); + if (channel?.isTextBased()) { + channel.send({ + embeds: [ + new EmbedBuilder() + .setTitle('User Banned via Banshare') + .setDescription( + `<@!${data.userId}> was banned!` + ) + .setFields([ + { + name: 'Reason', + value: modalResponse.components[0] + .components[0].value, + }, + { + name: 'By', + value: interaction.user.username, + }, + ]), + ], + }); + } + } }); } ); @@ -85,6 +123,7 @@ const handleBan = async (client: Client, req: Request) => { const embed = new EmbedBuilder() .setTitle(`Incoming ban from ${server}`) .addFields( + { name: 'User', value: `<@!${user.id}>` }, { name: 'Username', value: user.username }, { name: 'User ID', value: user.id }, { name: 'Present in server', value: `${present}` },