diff --git a/src/interactions/commands/handlers/info/info-helpers.ts b/src/interactions/commands/handlers/info/info-helpers.ts new file mode 100644 index 0000000..4f6b8ae --- /dev/null +++ b/src/interactions/commands/handlers/info/info-helpers.ts @@ -0,0 +1,10 @@ +import { BaseMessageOptions, EmbedBuilder } from 'discord.js'; + +export function getBaseEmbed() { + return new EmbedBuilder().setColor('#FFBE00'); +} + +export type InfoTopic = { + name: string; + message: BaseMessageOptions; +}; diff --git a/src/interactions/commands/handlers/info/info-slash.ts b/src/interactions/commands/handlers/info/info-slash.ts index 63a32b6..4d2e624 100644 --- a/src/interactions/commands/handlers/info/info-slash.ts +++ b/src/interactions/commands/handlers/info/info-slash.ts @@ -1,24 +1,20 @@ -import { EmbedBuilder, SlashCommandBuilder, userMention } from 'discord.js'; +import { SlashCommandBuilder, userMention } from 'discord.js'; import { CommandType, ICommandHandler } from '../../command-handler.interface'; -import { infoSubjects } from './info-subjects'; +import { infoTopics } from './topics'; import { replaceVariables } from '../../../../helpers/variable-replacer'; -export function getBaseEmbed() { - return new EmbedBuilder().setColor('#FFBE00'); -} - const config = new SlashCommandBuilder() .setName('info') .setDescription('Firebot info') .addStringOption((option) => option - .setName('subject') - .setDescription('The subject to post') + .setName('topic') + .setDescription('The topic to post') .setRequired(true) .setChoices( - infoSubjects.map((s) => ({ - name: s.name, - value: s.name, + infoTopics.map((t) => ({ + name: t.name, + value: t.name, })) ) ) @@ -35,14 +31,12 @@ export const infoSlashCommand: ICommandHandler = { async onTrigger(interaction) { await interaction.deferReply(); - const subjectName = interaction.options.getString('subject'); + const topicName = interaction.options.getString('topic'); - const message = infoSubjects.find( - (p) => p.name === subjectName - )?.message; + const message = infoTopics.find((p) => p.name === topicName)?.message; if (!message) { - await interaction.editReply('Invalid subject'); + await interaction.editReply('Invalid topic'); return; } diff --git a/src/interactions/commands/handlers/info/info-subjects.ts b/src/interactions/commands/handlers/info/info-subjects.ts deleted file mode 100644 index 080acda..0000000 --- a/src/interactions/commands/handlers/info/info-subjects.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { BaseMessageOptions } from "discord.js"; - -import { authIssues } from "./subjects/auth-issues"; -import { bitDefender } from "./subjects/bit-defender"; -import { butAnother } from "./subjects/but-another"; -import { cloudBackups } from "./subjects/cloud-backup"; -import { dataFolder } from "./subjects/data-folder"; -import { discordMentions } from "./subjects/discrod-mentions"; -import { expert } from "./subjects/expert"; -import { firebotLogs } from "./subjects/firebot-logs"; -import { instalLog } from "./subjects/install-log"; -import { manualRestore } from "./subjects/manual-restore"; -import { nightly } from "./subjects/nightly-builds"; -import { obsTroubleShooting } from "./subjects/obs-troubleshooting"; -import { offScreen } from "./subjects/offscreen"; -import { tuts } from "./subjects/tutorials"; - -export const infoSubjects: Array<{ - name: string; - message: BaseMessageOptions; -}> = [ - authIssues, - bitDefender, - butAnother, - cloudBackups, - dataFolder, - discordMentions, - expert, - firebotLogs, - instalLog, - manualRestore, - nightly, - obsTroubleShooting, - offScreen, - tuts, - ]; diff --git a/src/interactions/commands/handlers/info/subjects/auth-issues.ts b/src/interactions/commands/handlers/info/topics/auth-issues.ts similarity index 75% rename from src/interactions/commands/handlers/info/subjects/auth-issues.ts rename to src/interactions/commands/handlers/info/topics/auth-issues.ts index 9e76e86..4524118 100644 --- a/src/interactions/commands/handlers/info/subjects/auth-issues.ts +++ b/src/interactions/commands/handlers/info/topics/auth-issues.ts @@ -1,11 +1,10 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const authIssues = - { - name: 'Auth Issues', - message: { - embeds: [ - getBaseEmbed().setTitle('Auth Issues').setDescription(` +export const authIssues: InfoTopic = { + name: 'Auth Issues', + message: { + embeds: [ + getBaseEmbed().setTitle('Auth Issues').setDescription(` If you're experiencing issues with Firebot hanging on start up or failing to connect to Twitch, follow these steps to troubleshoot: 1. **Check Your Antivirus Software** @@ -23,6 +22,6 @@ If you're experiencing issues with Firebot hanging on start up or failing to con - Delete the file named \`auth-twitch.json\`. - Restart Firebot and log in again. `), - ], - }, - }; \ No newline at end of file + ], + }, +}; diff --git a/src/interactions/commands/handlers/info/subjects/bit-defender.ts b/src/interactions/commands/handlers/info/topics/bit-defender.ts similarity index 80% rename from src/interactions/commands/handlers/info/subjects/bit-defender.ts rename to src/interactions/commands/handlers/info/topics/bit-defender.ts index a0beac8..2e5e2e6 100644 --- a/src/interactions/commands/handlers/info/subjects/bit-defender.ts +++ b/src/interactions/commands/handlers/info/topics/bit-defender.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const bitDefender = { +export const bitDefender: InfoTopic = { name: 'Bit Defender', message: { embeds: [ @@ -12,4 +12,4 @@ Here you can report false positives: `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/but-another.ts b/src/interactions/commands/handlers/info/topics/but-another.ts similarity index 82% rename from src/interactions/commands/handlers/info/subjects/but-another.ts rename to src/interactions/commands/handlers/info/topics/but-another.ts index c840d1c..abb0b94 100644 --- a/src/interactions/commands/handlers/info/subjects/but-another.ts +++ b/src/interactions/commands/handlers/info/topics/but-another.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const butAnother = { +export const butAnother: InfoTopic = { name: 'But Another Bot Does It', message: { embeds: [ @@ -11,4 +11,4 @@ This is true in all walks of computer life and why there are so many tools that `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/cloud-backup.ts b/src/interactions/commands/handlers/info/topics/cloud-backup.ts similarity index 87% rename from src/interactions/commands/handlers/info/subjects/cloud-backup.ts rename to src/interactions/commands/handlers/info/topics/cloud-backup.ts index f342d00..5fc9295 100644 --- a/src/interactions/commands/handlers/info/subjects/cloud-backup.ts +++ b/src/interactions/commands/handlers/info/topics/cloud-backup.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const cloudBackups = { +export const cloudBackups: InfoTopic = { name: 'Cloud Backups', message: { embeds: [ @@ -16,4 +16,4 @@ This command creates a symbolic link between your Firebot V5 data folder (where `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/data-folder.ts b/src/interactions/commands/handlers/info/topics/data-folder.ts similarity index 73% rename from src/interactions/commands/handlers/info/subjects/data-folder.ts rename to src/interactions/commands/handlers/info/topics/data-folder.ts index 066aaee..a64fa02 100644 --- a/src/interactions/commands/handlers/info/subjects/data-folder.ts +++ b/src/interactions/commands/handlers/info/topics/data-folder.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const dataFolder = { +export const dataFolder: InfoTopic = { name: 'Data Folder', message: { embeds: [ @@ -9,4 +9,4 @@ You can get to Firebot's data folder via File > Open Data Folder or by pressing `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/discrod-mentions.ts b/src/interactions/commands/handlers/info/topics/discord-mentions.ts similarity index 79% rename from src/interactions/commands/handlers/info/subjects/discrod-mentions.ts rename to src/interactions/commands/handlers/info/topics/discord-mentions.ts index e7a8246..56faae4 100644 --- a/src/interactions/commands/handlers/info/subjects/discrod-mentions.ts +++ b/src/interactions/commands/handlers/info/topics/discord-mentions.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const discordMentions = { +export const discordMentions: InfoTopic = { name: 'Discord Mentions', message: { embeds: [ @@ -10,4 +10,4 @@ Then use \`<@&roleid>\` in the message (e.g. \`<@&9471923849123483>\`). `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/expert.ts b/src/interactions/commands/handlers/info/topics/expert.ts similarity index 93% rename from src/interactions/commands/handlers/info/subjects/expert.ts rename to src/interactions/commands/handlers/info/topics/expert.ts index 5a18a8e..1406218 100644 --- a/src/interactions/commands/handlers/info/subjects/expert.ts +++ b/src/interactions/commands/handlers/info/topics/expert.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const expert = { +export const expert: InfoTopic = { name: 'Firebot Expert', message: { embeds: [ @@ -18,4 +18,4 @@ We do not accept applications, referrals or requests in regards to the role. Nor `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/firebot-logs.ts b/src/interactions/commands/handlers/info/topics/firebot-logs.ts similarity index 72% rename from src/interactions/commands/handlers/info/subjects/firebot-logs.ts rename to src/interactions/commands/handlers/info/topics/firebot-logs.ts index 7d50c76..1053e52 100644 --- a/src/interactions/commands/handlers/info/subjects/firebot-logs.ts +++ b/src/interactions/commands/handlers/info/topics/firebot-logs.ts @@ -1,15 +1,16 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const firebotLogs = { +export const firebotLogs: InfoTopic = { name: 'Firebot Logs', 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**. `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/fresh-install.ts b/src/interactions/commands/handlers/info/topics/fresh-install.ts similarity index 81% rename from src/interactions/commands/handlers/info/subjects/fresh-install.ts rename to src/interactions/commands/handlers/info/topics/fresh-install.ts index b841c26..9535aa8 100644 --- a/src/interactions/commands/handlers/info/subjects/fresh-install.ts +++ b/src/interactions/commands/handlers/info/topics/fresh-install.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const reinstall = { +export const reinstall: InfoTopic = { name: 'Fresh Install', message: { embeds: [ @@ -15,4 +15,4 @@ To perform a fresh install: `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/topics/index.ts b/src/interactions/commands/handlers/info/topics/index.ts new file mode 100644 index 0000000..6729d76 --- /dev/null +++ b/src/interactions/commands/handlers/info/topics/index.ts @@ -0,0 +1,32 @@ +import { authIssues } from './auth-issues'; +import { bitDefender } from './bit-defender'; +import { butAnother } from './but-another'; +import { cloudBackups } from './cloud-backup'; +import { dataFolder } from './data-folder'; +import { discordMentions } from './discord-mentions'; +import { expert } from './expert'; +import { firebotLogs } from './firebot-logs'; +import { instalLog } from './install-log'; +import { manualRestore } from './manual-restore'; +import { nightly } from './nightly-builds'; +import { obsTroubleShooting } from './obs-troubleshooting'; +import { offScreen } from './offscreen'; +import { tuts } from './tutorials'; +import { InfoTopic } from '../info-helpers'; + +export const infoTopics: Array = [ + authIssues, + bitDefender, + butAnother, + cloudBackups, + dataFolder, + discordMentions, + expert, + firebotLogs, + instalLog, + manualRestore, + nightly, + obsTroubleShooting, + offScreen, + tuts, +]; diff --git a/src/interactions/commands/handlers/info/subjects/install-log.ts b/src/interactions/commands/handlers/info/topics/install-log.ts similarity index 86% rename from src/interactions/commands/handlers/info/subjects/install-log.ts rename to src/interactions/commands/handlers/info/topics/install-log.ts index fde668b..7e2bac7 100644 --- a/src/interactions/commands/handlers/info/subjects/install-log.ts +++ b/src/interactions/commands/handlers/info/topics/install-log.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const instalLog = { +export const instalLog: InfoTopic = { name: 'Install Log', message: { content: @@ -19,4 +19,4 @@ Once you've located the file, please upload it to this thread. `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/manual-restore.ts b/src/interactions/commands/handlers/info/topics/manual-restore.ts similarity index 91% rename from src/interactions/commands/handlers/info/subjects/manual-restore.ts rename to src/interactions/commands/handlers/info/topics/manual-restore.ts index 18d9df3..77f1b40 100644 --- a/src/interactions/commands/handlers/info/subjects/manual-restore.ts +++ b/src/interactions/commands/handlers/info/topics/manual-restore.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const manualRestore = { +export const manualRestore: InfoTopic = { name: 'Manual Restore', message: { embeds: [ @@ -19,4 +19,4 @@ If you are having issues with the automatic restore process within Firebot, you `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/nightly-builds.ts b/src/interactions/commands/handlers/info/topics/nightly-builds.ts similarity index 63% rename from src/interactions/commands/handlers/info/subjects/nightly-builds.ts rename to src/interactions/commands/handlers/info/topics/nightly-builds.ts index 57d7840..8ac8e2c 100644 --- a/src/interactions/commands/handlers/info/subjects/nightly-builds.ts +++ b/src/interactions/commands/handlers/info/topics/nightly-builds.ts @@ -1,13 +1,14 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const nightly = { +export const nightly: InfoTopic = { name: 'Nightly Builds', 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).` ), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/obs-troubleshooting.ts b/src/interactions/commands/handlers/info/topics/obs-troubleshooting.ts similarity index 91% rename from src/interactions/commands/handlers/info/subjects/obs-troubleshooting.ts rename to src/interactions/commands/handlers/info/topics/obs-troubleshooting.ts index cc8e6e9..7690a7d 100644 --- a/src/interactions/commands/handlers/info/subjects/obs-troubleshooting.ts +++ b/src/interactions/commands/handlers/info/topics/obs-troubleshooting.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const obsTroubleShooting = { +export const obsTroubleShooting: InfoTopic = { name: 'OBS Troubleshooting', message: { embeds: [ @@ -31,4 +31,4 @@ If you're experiencing issues with the OBS integration, follow these steps to tr `), ], }, -}; \ No newline at end of file +}; diff --git a/src/interactions/commands/handlers/info/subjects/offscreen.ts b/src/interactions/commands/handlers/info/topics/offscreen.ts similarity index 83% rename from src/interactions/commands/handlers/info/subjects/offscreen.ts rename to src/interactions/commands/handlers/info/topics/offscreen.ts index 4abe09a..814fcb4 100644 --- a/src/interactions/commands/handlers/info/subjects/offscreen.ts +++ b/src/interactions/commands/handlers/info/topics/offscreen.ts @@ -1,6 +1,6 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const offScreen = { +export const offScreen: InfoTopic = { name: 'Off Screen', message: { embeds: [ @@ -17,5 +17,3 @@ This will reset Firebot's window position. Reopen Firebot, and it should appear ], }, }; - - \ No newline at end of file diff --git a/src/interactions/commands/handlers/info/subjects/tutorials.ts b/src/interactions/commands/handlers/info/topics/tutorials.ts similarity index 83% rename from src/interactions/commands/handlers/info/subjects/tutorials.ts rename to src/interactions/commands/handlers/info/topics/tutorials.ts index 426aa77..82e0db7 100644 --- a/src/interactions/commands/handlers/info/subjects/tutorials.ts +++ b/src/interactions/commands/handlers/info/topics/tutorials.ts @@ -1,10 +1,9 @@ -import { getBaseEmbed } from "../info-slash"; +import { getBaseEmbed, InfoTopic } from '../info-helpers'; -export const tuts = -{ +export const tuts: InfoTopic = { name: 'Guides and Tutorials', message: { - content: "Guides and Tutorials by the community", + content: 'Guides and Tutorials by the community', embeds: [ getBaseEmbed().setTitle('Guides and Tutorials').setDescription(` Hi, here you can see a short list of guides and tutorials made by the community for Firebot: @@ -20,4 +19,4 @@ https://github.com/crowbartools/Firebot/wiki/Getting-Started `), ], }, -} \ No newline at end of file +};