Skip to content

Commit f68fac4

Browse files
committed
Big update to dependencies
1 parent 86feb90 commit f68fac4

42 files changed

Lines changed: 690 additions & 519 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ try {
3737
MojiraBot.logger.info( 'Debug mode is activated' );
3838
}
3939

40-
if ( BotConfig.logDirectory ) {
41-
MojiraBot.logger.info( `Writing log to ${ logConfig.appenders.log[ 'filename' ] }` );
40+
for ( const [id, appender] of Object.entries( logConfig.appenders ) ) {
41+
if ( appender.type === 'file' ) {
42+
MojiraBot.logger.info( `Logging to file ${ appender.filename }` );
43+
} else {
44+
MojiraBot.logger.info( `Logging to ${ appender.type } (id ${ id })` );
45+
}
4246
}
4347

4448
await MojiraBot.start();

package-lock.json

Lines changed: 456 additions & 310 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@
1212
"lintfix": "eslint . --fix"
1313
},
1414
"dependencies": {
15-
"@discordjs/rest": "^2.6.0",
16-
"better-sqlite3": "^12.8.0",
17-
"config": "^4.4.1",
18-
"discord.js": "^14.25.1",
15+
"@discordjs/rest": "^2.6.1",
16+
"better-sqlite3": "^12.11.1",
17+
"config": "^4.4.2",
18+
"discord.js": "^14.26.4",
1919
"emoji-regex": "^10.6.0",
2020
"escape-string-regexp": "^5.0.0",
21-
"jira.js": "^5.3.1",
22-
"js-yaml": "^4.1.1",
21+
"jira.js": "^5.4.0",
22+
"js-yaml": "^5.2.1",
2323
"log4js": "^6.9.1"
2424
},
2525
"devDependencies": {
2626
"@eslint/eslintrc": "^3.3.5",
2727
"@eslint/js": "^10.0.1",
2828
"@stylistic/eslint-plugin": "^5.10.0",
29-
"@types/config": "^4.4.0",
29+
"@types/better-sqlite3": "^7.6.13",
3030
"@types/node": "^24.0.0",
31-
"@typescript-eslint/eslint-plugin": "^8.57.1",
32-
"@typescript-eslint/parser": "^8.57.1",
33-
"eslint": "^10.1.0",
34-
"globals": "^17.4.0",
35-
"typescript": "^5.9.3"
31+
"@typescript-eslint/eslint-plugin": "^8.63.0",
32+
"@typescript-eslint/parser": "^8.63.0",
33+
"eslint": "^10.6.0",
34+
"globals": "^17.7.0",
35+
"typescript": "^6.0.3"
3636
},
3737
"engines": {
38-
"node": ">=18.0"
38+
"node": ">=24.0"
3939
}
4040
}

src/MojiraBot.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client, ClientUser, FetchMessagesOptions, GatewayIntentBits, Message, Partials, Snowflake, TextChannel } from 'discord.js';
1+
import { Client, ClientUser, Collection, FetchMessagesOptions, GatewayIntentBits, Message, Partials, Snowflake, TextChannel } from 'discord.js';
22
import log4js from 'log4js';
33
import { Version2Client as JiraClient } from 'jira.js';
44
import BotConfig from './BotConfig.js';
@@ -179,16 +179,15 @@ export default class MojiraBot {
179179

180180
let foundLastBotReaction = false;
181181
while ( !foundLastBotReaction ) {
182-
let fetchedMessages = await requestChannel.messages.fetch( { before: lastId } );
182+
let fetchedMessages: Collection<string, Message> = await requestChannel.messages.fetch( { before: lastId } );
183183

184184
if ( fetchedMessages.size === 0 ) break;
185185

186186
fetchedMessages = fetchedMessages.sort( ( a: Message, b: Message ) => {
187187
return a.createdAt < b.createdAt ? -1 : 1;
188188
} );
189189

190-
for ( const messageId of fetchedMessages.keys() ) {
191-
const message = fetchedMessages.get( messageId );
190+
for ( const message of fetchedMessages.values() ) {
192191
const hasBotReaction = message.reactions.cache.find( reaction => reaction.me ) !== undefined;
193192
const hasReactions = message.reactions.cache.size > 0;
194193

src/commands/BugCommand.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
1-
import { EmbedBuilder, ChatInputCommandInteraction, MessageFlagsBitField } from 'discord.js';
1+
import { EmbedBuilder, ChatInputCommandInteraction, MessageFlagsBitField, SlashCommandBuilder, SharedSlashCommand } from 'discord.js';
22
import Command from './commandHandlers/Command.js';
33
import { MentionRegistry } from '../mentions/MentionRegistry.js';
44
import BotConfig from '../BotConfig.js';
55
import { ChannelConfigUtil } from '../util/ChannelConfigUtil.js';
66
import SlashCommand from './commandHandlers/SlashCommand.js';
77

88
export default class BugCommand extends SlashCommand {
9-
public slashCommandBuilder = this.slashCommandBuilder
10-
.setName( 'bug' )
11-
.setDescription( 'Creates a embed with info from a ticket in Jira.' )
12-
.addStringOption( option =>
13-
option.setName( 'ticket-id' )
14-
.setDescription( 'The ID of the ticket.' )
15-
.setRequired( true )
16-
);
9+
public build(): SharedSlashCommand {
10+
return new SlashCommandBuilder()
11+
.setName( 'bug' )
12+
.setDescription( 'Creates a embed with info from a ticket in Jira.' )
13+
.addStringOption( option =>
14+
option.setName( 'ticket-id' )
15+
.setDescription( 'The ID of the ticket.' )
16+
.setRequired( true )
17+
);
18+
}
1719

1820
public async run( interaction: ChatInputCommandInteraction ): Promise<boolean> {
1921
if ( interaction.channel === null ) return false;
@@ -30,8 +32,8 @@ export default class BugCommand extends SlashCommand {
3032
if ( !ticketRegex.test( ticket ) ) {
3133
try {
3234
await interaction.reply( { content: `'${ ticket }' is not a valid ticket ID.`, flags: [MessageFlagsBitField.Flags.Ephemeral] } );
33-
} catch ( err ) {
34-
Command.logger.log( err );
35+
} catch ( error ) {
36+
Command.logger.log( error as string );
3537
return false;
3638
}
3739
return true;
@@ -43,11 +45,11 @@ export default class BugCommand extends SlashCommand {
4345
let embed: EmbedBuilder;
4446
try {
4547
embed = await mention.getEmbed();
46-
} catch ( err ) {
48+
} catch ( error ) {
4749
try {
48-
await interaction.reply( { content: err, flags: [MessageFlagsBitField.Flags.Ephemeral] } );
49-
} catch ( err ) {
50-
Command.logger.log( err );
50+
await interaction.reply( { content: error as string, flags: [MessageFlagsBitField.Flags.Ephemeral] } );
51+
} catch ( innerError ) {
52+
Command.logger.log( innerError as string );
5153
return false;
5254
}
5355
return true;

src/commands/HelpCommand.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import { ChatInputCommandInteraction, EmbedBuilder, MessageFlagsBitField } from 'discord.js';
1+
import { ChatInputCommandInteraction, EmbedBuilder, MessageFlagsBitField, SharedSlashCommand, SlashCommandBuilder } from 'discord.js';
22
import BotConfig from '../BotConfig.js';
33
import SlashCommand from './commandHandlers/SlashCommand.js';
44

55
export default class HelpCommand extends SlashCommand {
6-
public readonly slashCommandBuilder = this.slashCommandBuilder
7-
.setName( 'help' )
8-
.setDescription( 'Sends a help message.' );
6+
public build(): SharedSlashCommand {
7+
return new SlashCommandBuilder()
8+
.setName( 'help' )
9+
.setDescription( 'Sends a help message.' );
10+
}
911

1012
public async run( interaction: ChatInputCommandInteraction ): Promise<boolean> {
1113
try {

src/commands/MentionCommand.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { MentionRegistry } from '../mentions/MentionRegistry.js';
44
import BotConfig from '../BotConfig.js';
55
import { ChannelConfigUtil } from '../util/ChannelConfigUtil.js';
66
import DiscordUtil from '../util/DiscordUtil.js';
7+
import { JiraError } from 'jira.js';
78

89
export default class MentionCommand extends Command {
910
public static get ticketPattern(): string {
@@ -64,7 +65,8 @@ export default class MentionCommand extends Command {
6465
let embed: EmbedBuilder;
6566
try {
6667
embed = await mention.getEmbed();
67-
} catch ( jiraError ) {
68+
} catch ( error ) {
69+
const jiraError = error as JiraError;
6870
try {
6971
Command.logger.info( `Error when retreiving issue information: ${ jiraError.message }` );
7072
await message.channel.send( `${ message.author } ${ jiraError.message }` );

src/commands/ModmailBanCommand.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
import { ChatInputCommandInteraction } from 'discord.js';
1+
import { ChatInputCommandInteraction, SharedSlashCommand, SlashCommandBuilder } from 'discord.js';
22
import BotConfig from '../BotConfig.js';
33
import PermissionRegistry from '../permissions/PermissionRegistry.js';
44
import SlashCommand from './commandHandlers/SlashCommand.js';
55

66
export default class ModmailBanCommand extends SlashCommand {
7-
public readonly slashCommandBuilder = this.slashCommandBuilder
8-
.setName( 'modmailban' )
9-
.setDescription( 'Ban a user from using the modmail system.' )
10-
.addUserOption( option =>
11-
option.setName( 'user' )
12-
.setDescription( 'The user to ban.' )
13-
.setRequired( true )
14-
);
7+
public build(): SharedSlashCommand {
8+
return new SlashCommandBuilder()
9+
.setName( 'modmailban' )
10+
.setDescription( 'Ban a user from using the modmail system.' )
11+
.addUserOption( option =>
12+
option.setName( 'user' )
13+
.setDescription( 'The user to ban.' )
14+
.setRequired( true )
15+
);
16+
}
1517

1618
public readonly permissionLevel = PermissionRegistry.ADMIN_PERMISSION;
1719

src/commands/ModmailUnbanCommand.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
1-
import { ChatInputCommandInteraction, MessageFlagsBitField } from 'discord.js';
1+
import { ChatInputCommandInteraction, MessageFlagsBitField, SharedSlashCommand, SlashCommandBuilder } from 'discord.js';
22
import BotConfig from '../BotConfig.js';
33
import PermissionRegistry from '../permissions/PermissionRegistry.js';
44
import SlashCommand from './commandHandlers/SlashCommand.js';
55

66
export default class ModmailUnbanCommand extends SlashCommand {
7-
public readonly slashCommandBuilder = this.slashCommandBuilder
8-
.setName( 'modmailunban' )
9-
.setDescription( 'Unbans a user from using the modmail system.' )
10-
.addUserOption( option =>
11-
option.setName( 'user' )
12-
.setDescription( 'The user to unban.' )
13-
.setRequired( true )
14-
);
7+
public build(): SharedSlashCommand {
8+
return new SlashCommandBuilder()
9+
.setName( 'modmailunban' )
10+
.setDescription( 'Unbans a user from using the modmail system.' )
11+
.addUserOption( option =>
12+
option.setName( 'user' )
13+
.setDescription( 'The user to unban.' )
14+
.setRequired( true )
15+
);
16+
}
1517

1618
public readonly permissionLevel = PermissionRegistry.ADMIN_PERMISSION;
1719

src/commands/MooCommand.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
import { ChatInputCommandInteraction, InteractionCallbackResponse } from 'discord.js';
1+
import { ChatInputCommandInteraction, InteractionCallbackResponse, SharedSlashCommand, SlashCommandBuilder } from 'discord.js';
22
import { SingleMention } from '../mentions/SingleMention.js';
33
import { ReactionsUtil } from '../util/ReactionsUtil.js';
44
import SlashCommand from './commandHandlers/SlashCommand.js';
55

66
export default class MooCommand extends SlashCommand {
7-
public readonly slashCommandBuilder = this.slashCommandBuilder
8-
.setName( 'moo' )
9-
.setDescription( 'Mooooo.' );
7+
public build(): SharedSlashCommand {
8+
return new SlashCommandBuilder()
9+
.setName( 'moo' )
10+
.setDescription( 'Mooooo.' );
11+
}
1012

1113
public async run( interaction: ChatInputCommandInteraction ): Promise<boolean> {
1214
try {

0 commit comments

Comments
 (0)