mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 22:15:29 +00:00
fix: use new runValidators format on components
This commit is contained in:
1 parent
ae392f1a11
commit
74c1447e7d
3 files changed
+16
-22
No files matched your search
@@ -8,12 +8,6 @@ import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validati
|
|||||||
class FiltersDisableButtonComponent extends BaseComponentInteraction {
|
class FiltersDisableButtonComponent extends BaseComponentInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('filters-disable-button');
|
super('filters-disable-button');
|
||||||
|
|
||||||
this.validators = [
|
|
||||||
(args) => checkInVoiceChannel(args),
|
|
||||||
(args) => checkSameVoiceChannel(args),
|
|
||||||
(args) => checkQueueExists(args)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(params: BaseComponentParams): BaseComponentReturnType {
|
async execute(params: BaseComponentParams): BaseComponentReturnType {
|
||||||
@@ -22,7 +16,11 @@ class FiltersDisableButtonComponent extends BaseComponentInteraction {
|
|||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
await this.runValidators({ interaction, queue, executionId });
|
await this.runValidators({ interaction, queue, executionId }, [
|
||||||
|
checkInVoiceChannel,
|
||||||
|
checkSameVoiceChannel,
|
||||||
|
checkQueueExists
|
||||||
|
]);
|
||||||
|
|
||||||
// Reset filters before enabling provided filters
|
// Reset filters before enabling provided filters
|
||||||
if (queue.filters.ffmpeg.filters.length > 0) {
|
if (queue.filters.ffmpeg.filters.length > 0) {
|
||||||
|
|||||||
@@ -12,12 +12,6 @@ const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions
|
|||||||
class FiltersSelectMenuComponent extends BaseComponentInteraction {
|
class FiltersSelectMenuComponent extends BaseComponentInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('filters-select-menu');
|
super('filters-select-menu');
|
||||||
|
|
||||||
this.validators = [
|
|
||||||
(args) => checkInVoiceChannel(args),
|
|
||||||
(args) => checkSameVoiceChannel(args),
|
|
||||||
(args) => checkQueueExists(args)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(params: BaseComponentParams): BaseComponentReturnType {
|
async execute(params: BaseComponentParams): BaseComponentReturnType {
|
||||||
@@ -29,7 +23,11 @@ class FiltersSelectMenuComponent extends BaseComponentInteraction {
|
|||||||
const selectMenuInteraction: StringSelectMenuInteraction = interaction as StringSelectMenuInteraction;
|
const selectMenuInteraction: StringSelectMenuInteraction = interaction as StringSelectMenuInteraction;
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
await this.runValidators({ interaction, queue, executionId });
|
await this.runValidators({ interaction, queue, executionId }, [
|
||||||
|
checkInVoiceChannel,
|
||||||
|
checkSameVoiceChannel,
|
||||||
|
checkQueueExists
|
||||||
|
]);
|
||||||
|
|
||||||
queue.filters.ffmpeg.setInputArgs([
|
queue.filters.ffmpeg.setInputArgs([
|
||||||
'-threads',
|
'-threads',
|
||||||
|
|||||||
@@ -8,13 +8,6 @@ import { checkInVoiceChannel, checkSameVoiceChannel } from '../../utils/validati
|
|||||||
class NowplayingSkipButton extends BaseComponentInteraction {
|
class NowplayingSkipButton extends BaseComponentInteraction {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('nowplaying-skip-button');
|
super('nowplaying-skip-button');
|
||||||
|
|
||||||
this.validators = [
|
|
||||||
(args) => checkInVoiceChannel(args),
|
|
||||||
(args) => checkSameVoiceChannel(args),
|
|
||||||
(args) => checkQueueExists(args),
|
|
||||||
(args) => checkQueueCurrentTrack(args)
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(params: BaseComponentParams): BaseComponentReturnType {
|
async execute(params: BaseComponentParams): BaseComponentReturnType {
|
||||||
@@ -23,7 +16,12 @@ class NowplayingSkipButton extends BaseComponentInteraction {
|
|||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
await this.runValidators({ interaction, queue, executionId });
|
await this.runValidators({ interaction, queue, executionId }, [
|
||||||
|
checkInVoiceChannel,
|
||||||
|
checkSameVoiceChannel,
|
||||||
|
checkQueueExists,
|
||||||
|
checkQueueCurrentTrack
|
||||||
|
]);
|
||||||
|
|
||||||
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
|
if (!queue || (queue.tracks.data.length === 0 && !queue.currentTrack)) {
|
||||||
logger.debug('Tried skipping track but there was no queue.');
|
logger.debug('Tried skipping track but there was no queue.');
|
||||||
|
|||||||
Reference in new issue
Block a user