mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 14:38:49 +00:00
fix: more type annotation
This commit is contained in:
1 parent
3ac692d8eb
commit
2560f0fe9a
65 files changed
+408
-343
No files matched your search
@@ -1,17 +1,17 @@
|
||||
import config from 'config';
|
||||
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../services/logger';
|
||||
import { EmbedOptions } from '../../types/configTypes';
|
||||
import { CustomComponentInteraction } from '../../types/interactionTypes';
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember } from 'discord.js';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
|
||||
const component: CustomComponentInteraction = {
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger = loggerModule.child({
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'filters-disable-button.js',
|
||||
module: 'componentInteraction',
|
||||
name: 'filters-disable-button',
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
import config from 'config';
|
||||
|
||||
import loggerModule from '../../services/logger';
|
||||
import { EmbedOptions, FFmpegFilterOptions } from '../../types/configTypes';
|
||||
import { CustomComponentInteraction } from '../../types/interactionTypes';
|
||||
import { GuildQueue, QueueFilters, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, StringSelectMenuInteraction } from 'discord.js';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../services/logger';
|
||||
import { EmbedOptions, FFmpegFilterOption, FFmpegFilterOptions } from '../../types/configTypes';
|
||||
import { CustomComponentInteraction } from '../../types/interactionTypes';
|
||||
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||
|
||||
const component: CustomComponentInteraction = {
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger = loggerModule.child({
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'filters-select-menu.js',
|
||||
module: 'componentInteraction',
|
||||
name: 'filters-select-menu',
|
||||
@@ -23,7 +23,7 @@ const component: CustomComponentInteraction = {
|
||||
|
||||
logger.debug('Received select menu confirmation.');
|
||||
|
||||
const selectMenuInteraction = interaction as StringSelectMenuInteraction;
|
||||
const selectMenuInteraction: StringSelectMenuInteraction = interaction as StringSelectMenuInteraction;
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
const validators = [
|
||||
@@ -90,9 +90,10 @@ const component: CustomComponentInteraction = {
|
||||
embedOptions.icons.success
|
||||
} Filters toggled**\nNow using these filters:\n${selectMenuInteraction.values
|
||||
.map((enabledFilter: string) => {
|
||||
const filter = ffmpegFilterOptions.availableFilters.find(
|
||||
(filter) => enabledFilter == filter.value
|
||||
);
|
||||
const filter: FFmpegFilterOption | undefined =
|
||||
ffmpegFilterOptions.availableFilters.find(
|
||||
(filter) => enabledFilter == filter.value
|
||||
);
|
||||
|
||||
if (!filter) {
|
||||
return enabledFilter;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import config from 'config';
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember } from 'discord.js';
|
||||
|
||||
import loggerModule from '../../services/logger';
|
||||
@@ -7,11 +7,12 @@ import { EmbedOptions } from '../../types/configTypes';
|
||||
import { CustomComponentInteraction } from '../../types/interactionTypes';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||
import { Logger } from 'pino';
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
|
||||
const component: CustomComponentInteraction = {
|
||||
execute: async ({ interaction, referenceId, executionId }) => {
|
||||
const logger = loggerModule.child({
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'nowplaying-skip.js',
|
||||
module: 'componentInteraction',
|
||||
name: 'nowplaying-skip',
|
||||
@@ -69,7 +70,7 @@ const component: CustomComponentInteraction = {
|
||||
});
|
||||
}
|
||||
|
||||
const skippedTrack = queue.currentTrack!;
|
||||
const skippedTrack: Track = queue.currentTrack!;
|
||||
let durationFormat =
|
||||
Number(skippedTrack.raw.duration) === 0 || skippedTrack.duration === '0:00'
|
||||
? ''
|
||||
@@ -81,14 +82,14 @@ const component: CustomComponentInteraction = {
|
||||
queue.node.skip();
|
||||
logger.debug('Skipped the track.');
|
||||
|
||||
const loopModesFormatted = new Map([
|
||||
const loopModesFormatted: Map<number, string> = new Map([
|
||||
[0, 'disabled'],
|
||||
[1, 'track'],
|
||||
[2, 'queue'],
|
||||
[3, 'autoplay']
|
||||
]);
|
||||
|
||||
const repeatModeUserString = loopModesFormatted.get(queue.repeatMode);
|
||||
const repeatModeUserString: string = loopModesFormatted.get(queue.repeatMode)!;
|
||||
|
||||
let authorName: string;
|
||||
|
||||
|
||||
Reference in new issue
Block a user