Skip to content

Commit 35b5ab2

Browse files
authored
feat: add /info mod command
Info subjects
2 parents 8cec2f7 + 23f25a8 commit 35b5ab2

File tree

3 files changed

+163
-0
lines changed

3 files changed

+163
-0
lines changed

src/interactions/commands/command-manager.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { sendToQuestionsContextMenuCommand } from './handlers/send-to-questions-
1919
import { sendToIssuesContextMenuCommand } from './handlers/send-to-issues-context';
2020
import { randomFeaturedSlashCommand } from './handlers/random-featured-slash';
2121
import { docsSlashCommand } from './handlers/docs/docs-slash';
22+
import { infoSlashCommand } from './handlers/info/info-slash';
2223

2324
class CommandManager implements IInteractionManager {
2425
private handlers: ICommandHandler[] = [];
@@ -40,6 +41,7 @@ class CommandManager implements IInteractionManager {
4041
sendToQuestionsContextMenuCommand,
4142
randomFeaturedSlashCommand,
4243
docsSlashCommand,
44+
infoSlashCommand,
4345
];
4446

4547
for (const handler of commandsToRegister) {
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { SlashCommandBuilder, userMention } from 'discord.js';
2+
import { CommandType, ICommandHandler } from '../../command-handler.interface';
3+
import { infoSubjects } from './info-subjects';
4+
import { replaceVariables } from '../../../../helpers/variable-replacer';
5+
6+
const config = new SlashCommandBuilder()
7+
.setName('info')
8+
.setDescription('Firebot info')
9+
.setDefaultMemberPermissions(0)
10+
.addStringOption((option) =>
11+
option
12+
.setName('subject')
13+
.setDescription('The subject to post')
14+
.setRequired(true)
15+
.setChoices(
16+
infoSubjects.map((s) => ({
17+
name: s.name,
18+
value: s.name,
19+
}))
20+
)
21+
)
22+
.addUserOption((option) =>
23+
option
24+
.setName('targetuser')
25+
.setDescription('The user to target')
26+
.setRequired(false)
27+
);
28+
29+
export const infoSlashCommand: ICommandHandler = {
30+
type: CommandType.SlashCommand,
31+
config,
32+
async onTrigger(interaction) {
33+
await interaction.deferReply();
34+
35+
const subjectName = interaction.options.getString('subject');
36+
37+
const message = infoSubjects.find(
38+
(p) => p.name === subjectName
39+
)?.message;
40+
41+
if (!message) {
42+
await interaction.editReply('Invalid subject');
43+
return;
44+
}
45+
46+
const user = interaction.options.getUser('targetuser');
47+
48+
const variableMap = {
49+
['{user}']: userMention(interaction.user.id),
50+
['{target}']: userMention(user?.id),
51+
};
52+
53+
await interaction.editReply(replaceVariables(variableMap, message));
54+
},
55+
};
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
import { BaseMessageOptions, EmbedBuilder } from "discord.js";
2+
3+
export const infoSubjects: Array<{
4+
name: string;
5+
message: BaseMessageOptions;
6+
}> = [
7+
{
8+
name: "offScreen",
9+
message: {
10+
content: "Having issues with Firebot starting off screen or in some other weird place?",
11+
embeds: [
12+
new EmbedBuilder()
13+
.setColor(0xffbd00)
14+
.setTitle('Off Screen?')
15+
.setAuthor({
16+
name: 'Firebot Support',
17+
iconURL: 'https://raw.githubusercontent.com/crowbartools/Firebot/master/src/gui/images/logo.png',
18+
})
19+
.setDescription(`
20+
- Close Firebot
21+
- Press Windows + R to open the Windows Run dialog
22+
- Then paste\`%appdata%/Firebotv5\` into the box and press enter.
23+
- Delete the file: \`window-state.json\`
24+
`)
25+
]
26+
}
27+
},
28+
{
29+
name: "obssettings",
30+
message: {
31+
content: "OBS WebSocket related issues",
32+
embeds: [
33+
new EmbedBuilder()
34+
.setColor(0xffbd00)
35+
.setTitle('OBS WebSocket Settings')
36+
.setAuthor({
37+
name: 'Firebot Support',
38+
iconURL: 'https://raw.githubusercontent.com/crowbartools/Firebot/master/src/gui/images/logo.png',
39+
})
40+
.setDescription(`
41+
firebot
42+
settings> scripts> manage scripts delete OBS WebSockets if you have it.
43+
44+
did you enable the server in OBS?
45+
- on OBS Tools>obs-websockets-server
46+
- is it enabled
47+
- did you set a password
48+
- what is the port?
49+
50+
did you in integrations set the same password and port from OBS in the obs config of Firebot
51+
- on firebot Left hand side Settings>integrations> OBS config
52+
are the ports the same?
53+
is this the same PC?
54+
- yes
55+
is the address set to 127.0.0.1 or localhost
56+
- no
57+
did you use the address provided by OBS it is a "best guess" and not always correct
58+
`)
59+
]
60+
}
61+
},
62+
{
63+
name: "installlog",
64+
message: {
65+
content: "We are requesting your install log to futher help you",
66+
embeds: [
67+
new EmbedBuilder()
68+
.setColor(0xffbd00)
69+
.setTitle('Instal Logs')
70+
.setAuthor({
71+
name: 'Firebot Support',
72+
iconURL: 'https://raw.githubusercontent.com/crowbartools/Firebot/master/src/gui/images/logo.png',
73+
})
74+
.setDescription(`
75+
You can get to Firebot's data folder via File > Open Data Folder or by pressing "Win + R" and pasting: \`%appdata%\firebot\v5\`
76+
Please find the file named \`SquirrelSetup.log\` which is located in \`%localappdata%\Firebotv5\`
77+
and / or \`%localappdata%\Firebotv5\`
78+
and / or \`%localappdata%\SquirrelTemp\`
79+
and post it in this thread.
80+
`)
81+
]
82+
}
83+
},
84+
{
85+
name: "backuprequest",
86+
message: {
87+
content: "please send us your latest backup zip",
88+
embeds: [
89+
new EmbedBuilder()
90+
.setColor(0xffbd00)
91+
.setTitle('OBS WebSocket Settings')
92+
.setAuthor ({
93+
name: 'Firebot Support',
94+
iconURL: 'https://raw.githubusercontent.com/crowbartools/Firebot/master/src/gui/images/logo.png',
95+
})
96+
.setDescription (`
97+
Here's how you can do that:
98+
- Open Firebot and go to **Settings** > **Backup**
99+
- Press **Backup Now**
100+
- Next, go to **Manage Backups** > **Open Backups Folder**
101+
- DM {user} the latest **backup.zip** in that folder
102+
`)
103+
]
104+
}
105+
},
106+
];

0 commit comments

Comments
 (0)