Skip to content

Commit caaeada

Browse files
committed
chore: rename info subjects to "topics", improve typing
1 parent 9888ecb commit caaeada

19 files changed

+107
-109
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { BaseMessageOptions, EmbedBuilder } from 'discord.js';
2+
3+
export function getBaseEmbed() {
4+
return new EmbedBuilder().setColor('#FFBE00');
5+
}
6+
7+
export type InfoTopic = {
8+
name: string;
9+
message: BaseMessageOptions;
10+
};

src/interactions/commands/handlers/info/info-slash.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
import { EmbedBuilder, SlashCommandBuilder, userMention } from 'discord.js';
1+
import { SlashCommandBuilder, userMention } from 'discord.js';
22
import { CommandType, ICommandHandler } from '../../command-handler.interface';
3-
import { infoSubjects } from './info-subjects';
3+
import { infoTopics } from './topics';
44
import { replaceVariables } from '../../../../helpers/variable-replacer';
55

6-
export function getBaseEmbed() {
7-
return new EmbedBuilder().setColor('#FFBE00');
8-
}
9-
106
const config = new SlashCommandBuilder()
117
.setName('info')
128
.setDescription('Firebot info')
139
.addStringOption((option) =>
1410
option
15-
.setName('subject')
16-
.setDescription('The subject to post')
11+
.setName('topic')
12+
.setDescription('The topic to post')
1713
.setRequired(true)
1814
.setChoices(
19-
infoSubjects.map((s) => ({
20-
name: s.name,
21-
value: s.name,
15+
infoTopics.map((t) => ({
16+
name: t.name,
17+
value: t.name,
2218
}))
2319
)
2420
)
@@ -35,14 +31,12 @@ export const infoSlashCommand: ICommandHandler = {
3531
async onTrigger(interaction) {
3632
await interaction.deferReply();
3733

38-
const subjectName = interaction.options.getString('subject');
34+
const topicName = interaction.options.getString('topic');
3935

40-
const message = infoSubjects.find(
41-
(p) => p.name === subjectName
42-
)?.message;
36+
const message = infoTopics.find((p) => p.name === topicName)?.message;
4337

4438
if (!message) {
45-
await interaction.editReply('Invalid subject');
39+
await interaction.editReply('Invalid topic');
4640
return;
4741
}
4842

src/interactions/commands/handlers/info/info-subjects.ts

Lines changed: 0 additions & 36 deletions
This file was deleted.

src/interactions/commands/handlers/info/subjects/auth-issues.ts renamed to src/interactions/commands/handlers/info/topics/auth-issues.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { getBaseEmbed } from "../info-slash";
1+
import { getBaseEmbed, InfoTopic } from '../info-helpers';
22

3-
export const authIssues =
4-
{
5-
name: 'Auth Issues',
6-
message: {
7-
embeds: [
8-
getBaseEmbed().setTitle('Auth Issues').setDescription(`
3+
export const authIssues: InfoTopic = {
4+
name: 'Auth Issues',
5+
message: {
6+
embeds: [
7+
getBaseEmbed().setTitle('Auth Issues').setDescription(`
98
If you're experiencing issues with Firebot hanging on start up or failing to connect to Twitch, follow these steps to troubleshoot:
109
1110
1. **Check Your Antivirus Software**
@@ -23,6 +22,6 @@ If you're experiencing issues with Firebot hanging on start up or failing to con
2322
- Delete the file named \`auth-twitch.json\`.
2423
- Restart Firebot and log in again.
2524
`),
26-
],
27-
},
28-
};
25+
],
26+
},
27+
};

src/interactions/commands/handlers/info/subjects/bit-defender.ts renamed to src/interactions/commands/handlers/info/topics/bit-defender.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getBaseEmbed } from "../info-slash";
1+
import { getBaseEmbed, InfoTopic } from '../info-helpers';
22

3-
export const bitDefender = {
3+
export const bitDefender: InfoTopic = {
44
name: 'Bit Defender',
55
message: {
66
embeds: [
@@ -12,4 +12,4 @@ Here you can report false positives:
1212
`),
1313
],
1414
},
15-
};
15+
};

src/interactions/commands/handlers/info/subjects/but-another.ts renamed to src/interactions/commands/handlers/info/topics/but-another.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getBaseEmbed } from "../info-slash";
1+
import { getBaseEmbed, InfoTopic } from '../info-helpers';
22

3-
export const butAnother = {
3+
export const butAnother: InfoTopic = {
44
name: 'But Another Bot Does It',
55
message: {
66
embeds: [
@@ -11,4 +11,4 @@ This is true in all walks of computer life and why there are so many tools that
1111
`),
1212
],
1313
},
14-
};
14+
};

src/interactions/commands/handlers/info/subjects/cloud-backup.ts renamed to src/interactions/commands/handlers/info/topics/cloud-backup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getBaseEmbed } from "../info-slash";
1+
import { getBaseEmbed, InfoTopic } from '../info-helpers';
22

3-
export const cloudBackups = {
3+
export const cloudBackups: InfoTopic = {
44
name: 'Cloud Backups',
55
message: {
66
embeds: [
@@ -16,4 +16,4 @@ This command creates a symbolic link between your Firebot V5 data folder (where
1616
`),
1717
],
1818
},
19-
};
19+
};

src/interactions/commands/handlers/info/subjects/data-folder.ts renamed to src/interactions/commands/handlers/info/topics/data-folder.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getBaseEmbed } from "../info-slash";
1+
import { getBaseEmbed, InfoTopic } from '../info-helpers';
22

3-
export const dataFolder = {
3+
export const dataFolder: InfoTopic = {
44
name: 'Data Folder',
55
message: {
66
embeds: [
@@ -9,4 +9,4 @@ You can get to Firebot's data folder via File > Open Data Folder or by pressing
99
`),
1010
],
1111
},
12-
};
12+
};

src/interactions/commands/handlers/info/subjects/discrod-mentions.ts renamed to src/interactions/commands/handlers/info/topics/discord-mentions.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getBaseEmbed } from "../info-slash";
1+
import { getBaseEmbed, InfoTopic } from '../info-helpers';
22

3-
export const discordMentions = {
3+
export const discordMentions: InfoTopic = {
44
name: 'Discord Mentions',
55
message: {
66
embeds: [
@@ -10,4 +10,4 @@ Then use \`<@&roleid>\` in the message (e.g. \`<@&9471923849123483>\`).
1010
`),
1111
],
1212
},
13-
};
13+
};

src/interactions/commands/handlers/info/subjects/expert.ts renamed to src/interactions/commands/handlers/info/topics/expert.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { getBaseEmbed } from "../info-slash";
1+
import { getBaseEmbed, InfoTopic } from '../info-helpers';
22

3-
export const expert = {
3+
export const expert: InfoTopic = {
44
name: 'Firebot Expert',
55
message: {
66
embeds: [
@@ -18,4 +18,4 @@ We do not accept applications, referrals or requests in regards to the role. Nor
1818
`),
1919
],
2020
},
21-
};
21+
};

0 commit comments

Comments
 (0)