Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.4
1.0.5
5 changes: 1 addition & 4 deletions src/commands/create-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export async function handleCreateCommand(
return;
}

await interaction.deferReply();

const casual = !!interaction.options.getBoolean('casual', false);
const info = interaction.options.getString('info', false) ?? undefined;
const timeInMinutes =
Expand All @@ -56,11 +54,10 @@ export async function handleCreateCommand(

const rolePing = getPingsForServer(interaction, casual);

const reply = await interaction.editReply({
const reply = await interaction.reply({
content: rolePing || undefined,
embeds: [embed],
components: [buttonRow, selectRow],
allowedMentions: { parse: ['roles', 'users', 'everyone'] },
});
const message = await reply.fetch();
const matchId = randomUUID();
Expand Down
5 changes: 1 addition & 4 deletions src/commands/reping-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ export async function handleRepingCommand(
return;
}

await interaction.deferReply();

await eventManager.deleteRepingMessageIfExists(
userEventId,
interaction.client,
Expand All @@ -127,9 +125,8 @@ export async function handleRepingCommand(
const guildId = interaction.guildId;
const messageUrl = `https://discord.com/channels/${guildId}/${channelId}/${userEventId}`;

const reply = await interaction.editReply({
const reply = await interaction.reply({
content: REPING_MESSAGE(rolePing, missingPlayers, messageUrl),
allowedMentions: { parse: ['roles', 'users', 'everyone'] },
});

const repingMessage = await withRetry(
Expand Down
24 changes: 18 additions & 6 deletions src/tests/commands/create-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,18 @@ describe('create-command', () => {
getString: vi.fn(() => null),
getInteger: vi.fn(() => null),
},
reply: vi.fn().mockResolvedValue(undefined),
deferReply: vi.fn().mockResolvedValue(undefined),
reply: vi.fn().mockResolvedValue({
fetch: vi.fn().mockResolvedValue({
id: 'message123',
channelId: 'channel123',
}),
}),
deferReply: vi.fn().mockResolvedValue({
fetch: vi.fn().mockResolvedValue({
id: 'message123',
channelId: 'channel123',
}),
}),
editReply: vi.fn().mockResolvedValue({
fetch: vi.fn().mockResolvedValue({
id: 'message123',
Expand Down Expand Up @@ -102,7 +112,10 @@ describe('create-command', () => {
content: ERROR_MESSAGES.ALREADY_SIGNED_UP,
flags: ['Ephemeral'],
});
expect(mockInteraction.deferReply).not.toHaveBeenCalled();
expect(mockInteraction.reply).toHaveBeenCalledWith({
content: ERROR_MESSAGES.ALREADY_SIGNED_UP,
flags: ['Ephemeral'],
});
});
});

Expand All @@ -116,8 +129,7 @@ describe('create-command', () => {
mockTelemetry as never,
);

expect(mockInteraction.deferReply).toHaveBeenCalled();
expect(mockInteraction.editReply).toHaveBeenCalled();
expect(mockInteraction.reply).toHaveBeenCalled();
expect(mockEventManager.setCreator).toHaveBeenCalledWith(
'message123',
'user123',
Expand Down Expand Up @@ -264,7 +276,7 @@ describe('create-command', () => {

describe('error handling', () => {
it('should handle errors and call safeReplyToInteraction', async () => {
mockInteraction.deferReply.mockRejectedValue(new Error('Network error'));
mockInteraction.reply.mockRejectedValue(new Error('Network error'));
const { safeReplyToInteraction } = await import('../../utils/helpers.js');

await handleCreateCommand(
Expand Down
4 changes: 2 additions & 2 deletions src/tests/commands/reping-command.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ describe('reping-command', () => {
fetch: vi.fn().mockResolvedValue(mockChannel),
},
},
reply: vi.fn().mockResolvedValue(undefined),
deferReply: vi.fn().mockResolvedValue(undefined),
reply: vi.fn().mockResolvedValue(mockReply),
deferreply: vi.fn().mockResolvedValue(mockReply),
editReply: vi.fn().mockResolvedValue(mockReply),
};
}
Expand Down