🐛 fix: Temp patch broken music player

This commit is contained in:
2024-06-16 00:34:31 +07:00
parent a47a1d0c27
commit 34d5ce00d3
19 changed files with 1021 additions and 199 deletions
+13 -1
View File
@@ -15,7 +15,7 @@ import { I18n } from 'i18n';
import { joinVoiceChannelProcedure } from './Join';
import DiscordProvider from '../../providers/Discord';
import DiscordMusicPlayer, { TrackUtils, ValidTracks } from '../../providers/DiscordMusicPlayer';
import DiscordMusicPlayer, { TrackUtils, ValidTracks } from '../../providers/DiscordMusicPlayerTempFix';
import Locale from '../../services/Locale';
import DiscordModule, { HybridInteractionMessage } from '../../utils/DiscordModule';
@@ -92,6 +92,12 @@ const EMBEDS = {
description: errorMessage,
user: data.getUser()
});
},
TOO_LONG: (data: HybridInteractionMessage, locale: I18n) => {
return makeErrorEmbed({
title: locale.__('musicplayer_play.too_long'),
user: data.getUser()
});
}
};
export default class Play extends DiscordModule {
@@ -455,6 +461,12 @@ export default class Play extends DiscordModule {
}
instance.addTrackToQueue(result[0]);
// Max 1 hour
if (result[0].durationInSec > 3600)
return await sendHybridInteractionMessageResponse(data, {
embeds: [EMBEDS.TOO_LONG(data, locale)]
});
if (result.length > 1) {
// TODO: Find a better logic than this
// If the first result title is exact match with the query or first title contains half the space of the query, it's probably a sentence