Skip to content

Commit ee07fe6

Browse files
authored
Minimal dependency updates (#315)
Mainly updating jira.js to use newer API endpoints
1 parent cc34614 commit ee07fe6

17 files changed

+346
-162
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"discord.js": "^14.16.3",
1919
"emoji-regex": "^10.4.0",
2020
"escape-string-regexp": "^5.0.0",
21-
"jira.js": "^2.20.1",
21+
"jira.js": "^5.2.2",
2222
"js-yaml": "^4.1.0",
2323
"log4js": "^6.4.0"
2424
},

src/commands/BugCommand.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EmbedBuilder, ChatInputCommandInteraction } from 'discord.js';
1+
import { EmbedBuilder, ChatInputCommandInteraction, MessageFlagsBitField } from 'discord.js';
22
import Command from './commandHandlers/Command.js';
33
import { MentionRegistry } from '../mentions/MentionRegistry.js';
44
import BotConfig from '../BotConfig.js';
@@ -29,7 +29,7 @@ export default class BugCommand extends SlashCommand {
2929
for ( const ticket of tickets ) {
3030
if ( !ticketRegex.test( ticket ) ) {
3131
try {
32-
await interaction.reply( { content: `'${ ticket }' is not a valid ticket ID.`, ephemeral: true } );
32+
await interaction.reply( { content: `'${ ticket }' is not a valid ticket ID.`, flags: [MessageFlagsBitField.Flags.Ephemeral] } );
3333
} catch ( err ) {
3434
Command.logger.log( err );
3535
return false;
@@ -45,7 +45,7 @@ export default class BugCommand extends SlashCommand {
4545
embed = await mention.getEmbed();
4646
} catch ( err ) {
4747
try {
48-
await interaction.reply( { content: err, ephemeral: true } );
48+
await interaction.reply( { content: err, flags: [MessageFlagsBitField.Flags.Ephemeral] } );
4949
} catch ( err ) {
5050
Command.logger.log( err );
5151
return false;

src/commands/HelpCommand.ts

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

@@ -31,7 +31,7 @@ export default class HelpCommand extends SlashCommand {
3131
\`/tips\` - Sends helpful info on how to use the bug tracker and this Discord server.`,
3232
} )
3333
.setFooter( { text: interaction.user.tag, iconURL: interaction.user.avatarURL() ?? undefined } );
34-
await interaction.reply( { embeds: [embed], ephemeral: true } );
34+
await interaction.reply( { embeds: [embed], flags: [MessageFlagsBitField.Flags.Ephemeral] } );
3535
} catch {
3636
return false;
3737
}

src/commands/ModmailUnbanCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChatInputCommandInteraction } from 'discord.js';
1+
import { ChatInputCommandInteraction, MessageFlagsBitField } from 'discord.js';
22
import BotConfig from '../BotConfig.js';
33
import PermissionRegistry from '../permissions/PermissionRegistry.js';
44
import SlashCommand from './commandHandlers/SlashCommand.js';
@@ -25,7 +25,7 @@ export default class ModmailUnbanCommand extends SlashCommand {
2525
WHERE user = ?`
2626
).run( args.id );
2727
if ( unban.changes == 0 ) {
28-
await interaction.reply( { content: 'User was never banned.', ephemeral: true } );
28+
await interaction.reply( { content: 'User was never banned.', flags: [MessageFlagsBitField.Flags.Ephemeral] } );
2929

3030
return true;
3131
}

src/commands/PollCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChatInputCommandInteraction, Message, EmbedBuilder } from 'discord.js';
1+
import { ChatInputCommandInteraction, Message, EmbedBuilder, MessageFlagsBitField } from 'discord.js';
22
import Command from './commandHandlers/Command.js';
33
import emojiRegex from 'emoji-regex';
44
import PermissionRegistry from '../permissions/PermissionRegistry.js';
@@ -43,7 +43,7 @@ export default class PollCommand extends SlashCommand {
4343
\`\`\`
4444
<emoji> [<First option name>]~<emoji> [<Second option name>]~...
4545
\`\`\``.replace( /\t/g, '' ),
46-
ephemeral: true,
46+
flags: [MessageFlagsBitField.Flags.Ephemeral],
4747
} );
4848
} catch ( err ) {
4949
Command.logger.error( err );

src/commands/SearchCommand.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EmbedBuilder, escapeMarkdown, ChatInputCommandInteraction } from 'discord.js';
1+
import { EmbedBuilder, escapeMarkdown, ChatInputCommandInteraction, MessageFlagsBitField } from 'discord.js';
22
import SlashCommand from './commandHandlers/SlashCommand.js';
33
import BotConfig from '../BotConfig.js';
44
import MojiraBot from '../MojiraBot.js';
@@ -22,15 +22,15 @@ export default class SearchCommand extends SlashCommand {
2222
try {
2323
const embed = new EmbedBuilder();
2424
const searchFilter = `(description ~ "${ plainArgs }" OR summary ~ "${ plainArgs }") AND project in (${ BotConfig.projects.join( ', ' ) })`;
25-
const searchResults = await MojiraBot.jira.issueSearch.searchForIssuesUsingJql( {
25+
const searchResults = await MojiraBot.jira.issueSearch.searchForIssuesUsingJqlEnhancedSearch( {
2626
jql: searchFilter,
2727
maxResults: BotConfig.maxSearchResults,
2828
fields: [ 'key', 'summary' ],
2929
} );
3030

3131
if ( !searchResults.issues ) {
3232
embed.setTitle( `No results found for "${ escapeMarkdown( plainArgs ) }"` );
33-
await interaction.reply( { embeds: [embed], ephemeral: true } );
33+
await interaction.reply( { embeds: [embed], flags: [MessageFlagsBitField.Flags.Ephemeral] } );
3434
return true;
3535
}
3636

@@ -48,14 +48,14 @@ export default class SearchCommand extends SlashCommand {
4848
embed.setDescription( `__[See all results](https://bugs.mojang.com/issues/?jql=${ escapedJql })__` );
4949

5050
if ( interaction.channel !== null && ChannelConfigUtil.publicSearch( interaction.channel ) ) {
51-
await interaction.reply( { embeds: [embed], ephemeral: false } );
51+
await interaction.reply( { embeds: [embed] } );
5252
} else {
53-
await interaction.reply( { embeds: [embed], ephemeral: true } );
53+
await interaction.reply( { embeds: [embed], flags: [MessageFlagsBitField.Flags.Ephemeral] } );
5454
}
5555
} catch {
5656
const embed = new EmbedBuilder();
5757
embed.setTitle( `No results found for "${ escapeMarkdown( plainArgs ) }"` );
58-
await interaction.reply( { embeds: [embed], ephemeral: true } );
58+
await interaction.reply( { embeds: [embed], flags: [MessageFlagsBitField.Flags.Ephemeral] } );
5959
return false;
6060
}
6161

src/commands/SendCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { EmbedBuilder, TextChannel, NewsChannel, ChatInputCommandInteraction } from 'discord.js';
1+
import { EmbedBuilder, TextChannel, NewsChannel, ChatInputCommandInteraction, MessageFlagsBitField } from 'discord.js';
22
import PermissionRegistry from '../permissions/PermissionRegistry.js';
33
import SlashCommand from './commandHandlers/SlashCommand.js';
44

@@ -54,7 +54,7 @@ export default class SendCommand extends SlashCommand {
5454
}
5555
}
5656
} else {
57-
await interaction.reply( { content: `**Error:** ${ channel.name } is not a valid channel. `, ephemeral: true } );
57+
await interaction.reply( { content: `**Error:** ${ channel.name } is not a valid channel. `, flags: [MessageFlagsBitField.Flags.Ephemeral] } );
5858
return true;
5959
}
6060

src/commands/TipsCommand.ts

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

44
export default class TipsCommand extends SlashCommand {
@@ -18,7 +18,7 @@ export default class TipsCommand extends SlashCommand {
1818
Afterwards, you can use corresponding request channels in each project to make requests for changes to tickets on the bug tracker, like resolutions and adding affected versions.
1919
The moderators and helpers of the bug tracker will then be able to see the requests and resolve them.`.replace( /\t/g, '' ) )
2020
.setFooter( { text: interaction.user.tag, iconURL: interaction.user.avatarURL() ?? undefined } );
21-
await interaction.reply( { embeds: [embed], ephemeral: true } );
21+
await interaction.reply( { embeds: [embed], flags: [MessageFlagsBitField.Flags.Ephemeral] } );
2222
} catch {
2323
return false;
2424
}

src/commands/commandHandlers/SlashCommandRegister.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import SlashCommand from './SlashCommand.js';
22
import SlashCommandRegistry from './SlashCommandRegistry.js';
33
import { REST } from '@discordjs/rest';
44
import { Routes } from 'discord-api-types/v9';
5-
import { Client, Collection, RESTPostAPIApplicationCommandsJSONBody, ChatInputCommandInteraction, GuildMember } from 'discord.js';
5+
import { Client, Collection, RESTPostAPIApplicationCommandsJSONBody, ChatInputCommandInteraction, GuildMember, MessageFlagsBitField } from 'discord.js';
66
import { SlashCommandJsonData } from '../../types/discord.js';
77
import { ChannelConfigUtil } from '../../util/ChannelConfigUtil.js';
88

@@ -29,12 +29,12 @@ export default class SlashCommandRegister {
2929

3030
if ( command.checkPermission( member ) ) {
3131
if ( interaction.channel !== null && ChannelConfigUtil.commandsDisabled( interaction.channel ) ) {
32-
await interaction.reply( { content: 'Commands are not allowed in this channel.', ephemeral: true } );
32+
await interaction.reply( { content: 'Commands are not allowed in this channel.', flags: [MessageFlagsBitField.Flags.Ephemeral] } );
3333
} else if ( !await command.run( interaction ) ) {
34-
await interaction.reply( { content: 'An error occurred while running this command.', ephemeral: true } );
34+
await interaction.reply( { content: 'An error occurred while running this command.', flags: [MessageFlagsBitField.Flags.Ephemeral] } );
3535
}
3636
} else {
37-
await interaction.reply( { content: 'You do not have permission to use this command.', ephemeral: true } );
37+
await interaction.reply( { content: 'You do not have permission to use this command.', flags: [MessageFlagsBitField.Flags.Ephemeral] } );
3838
}
3939
},
4040
};

0 commit comments

Comments
 (0)