From e49c3b44519c8cd7dc3d732238162e0c425fb5d3 Mon Sep 17 00:00:00 2001 From: CKY- Date: Mon, 9 Dec 2024 13:37:33 -0700 Subject: [PATCH] move backup request --- .../commands/handlers/backup-request.ts | 37 +++++++++++++++++++ .../commands/handlers/info/info-slash.ts | 1 - .../commands/handlers/info/info-subjects.ts | 20 +--------- 3 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 src/interactions/commands/handlers/backup-request.ts diff --git a/src/interactions/commands/handlers/backup-request.ts b/src/interactions/commands/handlers/backup-request.ts new file mode 100644 index 0000000..ae9543d --- /dev/null +++ b/src/interactions/commands/handlers/backup-request.ts @@ -0,0 +1,37 @@ +import { EmbedBuilder, SlashCommandBuilder, userMention } from 'discord.js'; +import { CommandType, ICommandHandler } from '../command-handler.interface'; +import { replaceVariables } from '../../../helpers/variable-replacer'; +function getBaseEmbed() { + return new EmbedBuilder().setColor('#FFBE00'); +} +const config = new SlashCommandBuilder() + .setName('Backup Request') + .setDescription('Request a users backup') + .setDefaultMemberPermissions(0); + +export const saySlashCommand: ICommandHandler = { + type: CommandType.SlashCommand, + config, + async onTrigger(interaction) { + await interaction.deferReply(); + + const message = { + content: 'Please send us your latest backup zip', + embeds: [ + getBaseEmbed().setTitle('How to send a backup').setDescription(` +- Open Firebot and go to **Settings** > **Backup** +- Press **Backup Now** +- Next, go to **Manage Backups** > **Open Backups Folder** +- DM {user} the latest **backup.zip** in that folder +`), + ], + }; + + + const variableMap = { + ['{user}']: userMention(interaction.user.id), + }; + + await interaction.editReply(replaceVariables(variableMap, message)); + }, +}; diff --git a/src/interactions/commands/handlers/info/info-slash.ts b/src/interactions/commands/handlers/info/info-slash.ts index b2a120c..77bfd6f 100644 --- a/src/interactions/commands/handlers/info/info-slash.ts +++ b/src/interactions/commands/handlers/info/info-slash.ts @@ -6,7 +6,6 @@ import { replaceVariables } from '../../../../helpers/variable-replacer'; const config = new SlashCommandBuilder() .setName('info') .setDescription('Firebot info') - .setDefaultMemberPermissions(0) .addStringOption((option) => option .setName('subject') diff --git a/src/interactions/commands/handlers/info/info-subjects.ts b/src/interactions/commands/handlers/info/info-subjects.ts index 9efa533..c14037d 100644 --- a/src/interactions/commands/handlers/info/info-subjects.ts +++ b/src/interactions/commands/handlers/info/info-subjects.ts @@ -73,20 +73,6 @@ To locate your Firebot install logs: Look for a file named \`SquirrelSetup.log\`. If you don't see it in the first location, try the second. Once you've located the file, please upload it to this thread. -`), - ], - }, - }, - { - name: 'Backup Request', - message: { - content: 'Please send us your latest backup zip', - embeds: [ - getBaseEmbed().setTitle('How to send a backup').setDescription(` -- Open Firebot and go to **Settings** > **Backup** -- Press **Backup Now** -- Next, go to **Manage Backups** > **Open Backups Folder** -- DM {user} the latest **backup.zip** in that folder `), ], }, @@ -96,8 +82,7 @@ Once you've located the file, please upload it to this thread. message: { embeds: [ getBaseEmbed() - .setTitle('Nightly Builds') - .setDescription( + .setTitle('Nightly Builds').setDescription( `You can find more information about the Nightly builds [here](https://discord.com/channels/372817064034959370/372821213443129346/973669737877889094).` ), ], @@ -108,8 +93,7 @@ Once you've located the file, please upload it to this thread. message: { content: 'Please post your latest Firebot log file', embeds: [ - getBaseEmbed().setTitle('How to locate your Logs folder') - .setDescription(` + getBaseEmbed().setTitle('How to locate your Logs folder').setDescription(` 1. In Firebot, go to **File** > **Open Logs Folder** - or - 2. Press **Win + R**, paste \`%appdata%\\Firebot\\v5\\logs\\\` into the field, and click **OK**.