Skip to content

Commit

Permalink
chore: rename info subjects to "topics", improve typing
Browse files Browse the repository at this point in the history
  • Loading branch information
ebiggz committed Dec 12, 2024
1 parent 9888ecb commit caaeada
Show file tree
Hide file tree
Showing 19 changed files with 107 additions and 109 deletions.
10 changes: 10 additions & 0 deletions src/interactions/commands/handlers/info/info-helpers.ts
Original file line number Diff line number Diff line change
@@ -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;
};
26 changes: 10 additions & 16 deletions src/interactions/commands/handlers/info/info-slash.ts
Original file line number Diff line number Diff line change
@@ -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,
}))
)
)
Expand All @@ -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;
}

Expand Down
36 changes: 0 additions & 36 deletions src/interactions/commands/handlers/info/info-subjects.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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**
Expand All @@ -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.
`),
],
},
};
],
},
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -12,4 +12,4 @@ Here you can report false positives:
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -11,4 +11,4 @@ This is true in all walks of computer life and why there are so many tools that
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -16,4 +16,4 @@ This command creates a symbolic link between your Firebot V5 data folder (where
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -9,4 +9,4 @@ You can get to Firebot's data folder via File > Open Data Folder or by pressing
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -10,4 +10,4 @@ Then use \`<@&roleid>\` in the message (e.g. \`<@&9471923849123483>\`).
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -18,4 +18,4 @@ We do not accept applications, referrals or requests in regards to the role. Nor
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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**.
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -15,4 +15,4 @@ To perform a fresh install:
`),
],
},
};
};
32 changes: 32 additions & 0 deletions src/interactions/commands/handlers/info/topics/index.ts
Original file line number Diff line number Diff line change
@@ -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<InfoTopic> = [
authIssues,
bitDefender,
butAnother,
cloudBackups,
dataFolder,
discordMentions,
expert,
firebotLogs,
instalLog,
manualRestore,
nightly,
obsTroubleShooting,
offScreen,
tuts,
];
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -19,4 +19,4 @@ Once you've located the file, please upload it to this thread.
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -19,4 +19,4 @@ If you are having issues with the automatic restore process within Firebot, you
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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).`
),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand Down Expand Up @@ -31,4 +31,4 @@ If you're experiencing issues with the OBS integration, follow these steps to tr
`),
],
},
};
};
Original file line number Diff line number Diff line change
@@ -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: [
Expand All @@ -17,5 +17,3 @@ This will reset Firebot's window position. Reopen Firebot, and it should appear
],
},
};


Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -20,4 +19,4 @@ https://github.com/crowbartools/Firebot/wiki/Getting-Started
`),
],
},
}
};

0 comments on commit caaeada

Please sign in to comment.