feat!: better handling and error handling for interaction events

This commit is contained in:
Marius Begby committed 2023-08-28 15:16:55 +02:00
1 parent 1ec1281e98
commit f231c53fe8
6 files changed
+270 -361

No files matched your search

@@ -8,7 +8,7 @@ import { CustomComponentInteraction } from '../../types/interactionTypes';
const embedOptions: EmbedOptions = config.get('embedOptions');
const component: CustomComponentInteraction = {
execute: async ({ interaction, trackId, executionId }) => {
execute: async ({ interaction, referenceId, executionId }) => {
const logger = loggerModule.child({
source: 'nowplaying-skip.js',
module: 'componentInteraction',
@@ -20,7 +20,7 @@ const component: CustomComponentInteraction = {
const queue: NodeResolvable = useQueue(interaction.guild!.id)!;
logger.debug(`Received skip confirmation for track id ${trackId}.`);
logger.debug(`Received skip confirmation for track id ${referenceId}.`);
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
logger.debug('Tried skipping track but there was no queue.');
@@ -37,7 +37,7 @@ const component: CustomComponentInteraction = {
});
}
if (queue.currentTrack!.id !== trackId) {
if (queue.currentTrack!.id !== referenceId) {
logger.debug('Tried skipping track but it is not the current track and therefore already skipped/removed.');
logger.debug('Responding with warning embed.');