Skip to content

Commit

Permalink
fix: vatsim events max fields (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
benw202 authored Jan 20, 2024
1 parent 628d4aa commit 16bd70c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@

Update <small>_ January 2024</small>

- fix: vatsim events max fields (20/01/2024)
- fix: user and mod log exclude id's (18/01/2024)
- feat: New FBW Utils and Moderation bot (08/01/2024)
2 changes: 1 addition & 1 deletion src/commands/utils/vatsim/functions/vatsimEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function handleVatsimEvents(interaction: ChatInputCommandInteractio
.then((res) => res.json())
.then((res) => res.data)
.then((res) => res.filter((event: { type: string; }) => event.type === 'Event'))
.then((res) => res.slice(0, 6));
.then((res) => res.slice(0, 5));

const fields: EmbedField[] = eventsList.map((event: any) => {
// eslint-disable-next-line camelcase
Expand Down
10 changes: 9 additions & 1 deletion src/events/contextInteractionHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color, ContextMenuCommand, event, Events, Reply } from '../lib';
import { Color, ContextMenuCommand, event, Events, makeEmbed, Reply } from '../lib';
import contextArray from '../commands/context';

const contextMap = new Map<string, ContextMenuCommand>(
Expand Down Expand Up @@ -30,8 +30,16 @@ export default event(Events.InteractionCreate, async ({ log, client }, interacti

await context.callback({ client, log, interaction });
} catch (error) {
const errorEmbed = makeEmbed({
title: 'An error occurred while executing this context command.',
description: `${error}`,
color: Color.Error,
});

log('[Context Error]', error);

await interaction.followUp({ embeds: [errorEmbed] });

if (interaction.deferred || interaction.replied) {
log('Interaction was already replied to or deferred, ignoring');
}
Expand Down
10 changes: 9 additions & 1 deletion src/events/slashCommandHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Color, SlashCommand, event, Events, Reply } from '../lib';
import { Color, SlashCommand, event, Events, Reply, makeEmbed } from '../lib';
import commandArray from '../commands';

/* eslint-disable no-underscore-dangle */
Expand Down Expand Up @@ -58,8 +58,16 @@ export default event(Events.InteractionCreate, async ({ log, client }, interacti

await command.callback({ client, log, interaction });
} catch (error) {
const errorEmbed = makeEmbed({
title: 'An error occurred while executing this command.',
description: `${error}`,
color: Color.Error,
});

log('[Command Error]', error);

await interaction.followUp({ embeds: [errorEmbed] });

if (interaction.deferred || interaction.replied) {
log('Interaction was already replied to or deferred, ignoring');
}
Expand Down

0 comments on commit 16bd70c

Please sign in to comment.