mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
converted commands to classes
This commit is contained in:
1 parent
335f4bb84e
commit
d81fc1d2e7
35 files changed
+544
-694
No files matched your search
@@ -35,10 +35,10 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`${embedOptions.icons.warning} **${client.user?.tag}** is **\`disconnected\`**!` +
|
`${this.embedOptions.icons.warning} **${client.user?.tag}** is **\`disconnected\`**!` +
|
||||||
`\n\n<@${systemOptions.systemUserId}>`
|
`\n\n<@${systemOptions.systemUserId}>`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,9 +50,9 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.success} All shards ready**\n**${client.user?.tag}** is now **\`online\`**!`
|
`**${this.embedOptions.icons.success} All shards ready**\n**${client.user?.tag}** is now **\`online\`**!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,10 +36,10 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`${embedOptions.icons.warning} **${client.user?.tag}** is **\`reconnecting\`**!` +
|
`${this.embedOptions.icons.warning} **${client.user?.tag}** is **\`reconnecting\`**!` +
|
||||||
`\n\n<@${systemOptions.systemUserId}>`
|
`\n\n<@${systemOptions.systemUserId}>`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue related to the queue or current track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue related to the queue or current track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -47,10 +47,10 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`${embedOptions.icons.error} **player.events.on('error')**\nExecution id: ${executionId}\n${error.message}` +
|
`${this.embedOptions.icons.error} **player.events.on('error')**\nExecution id: ${executionId}\n${error.message}` +
|
||||||
`\n\n<@${systemOptions.systemUserId}>`
|
`\n\n<@${systemOptions.systemUserId}>`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue while streaming the track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue while streaming the track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -47,10 +47,10 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`${embedOptions.icons.error} **player.events.on('playerError')**\nExecution id: ${executionId}\n${error.message}` +
|
`${this.embedOptions.icons.error} **player.events.on('playerError')**\nExecution id: ${executionId}\n${error.message}` +
|
||||||
`\n\n<@${systemOptions.systemUserId}>`
|
`\n\n<@${systemOptions.systemUserId}>`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue while loading stream for the track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nIt seems there was an issue while loading stream for the track.\n\nIf you performed a command, you can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -48,10 +48,10 @@ module.exports = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`${embedOptions.icons.error} **player.events.on('playerSkip')**\nExecution id: ${executionId}\n${track.url}` +
|
`${this.embedOptions.icons.error} **player.events.on('playerSkip')**\nExecution id: ${executionId}\n${track.url}` +
|
||||||
`\n\n<@${systemOptions.systemUserId}>`
|
`\n\n<@${systemOptions.systemUserId}>`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ export const handleError = async (
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to perform this action. You can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.error} Uh-oh... _Something_ went wrong!**\nThere was an unexpected error while trying to perform this action. You can try again.\n\n_If this problem persists, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,33 +1,23 @@
|
|||||||
import config from 'config';
|
|
||||||
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||||
import osu from 'node-os-utils';
|
import osu from 'node-os-utils';
|
||||||
import { Logger } from 'pino';
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { version } from '../../../../package.json';
|
import { version } from '../../../../package.json';
|
||||||
import loggerModule from '../../../services/logger';
|
import {
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandInteraction,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class StatusCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
|
const data = new SlashCommandBuilder().setName('status').setDescription('Show the bot and system status.');
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
|
||||||
const command: BaseSlashCommandInteraction = {
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
isNew: false,
|
const { executionId, interaction, client } = params;
|
||||||
isBeta: false,
|
const logger = this.getLogger('status.js', executionId, interaction);
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('status')
|
|
||||||
.setDescription('Show the bot and system status.')
|
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false),
|
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
|
||||||
source: 'status.js',
|
|
||||||
module: 'slashCommand',
|
|
||||||
name: '/status',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const uptimeString: string = await getUptimeFormatted({ executionId });
|
const uptimeString: string = await getUptimeFormatted({ executionId });
|
||||||
const usedMemoryInMB: string = Math.ceil((await osu.mem.info()).usedMemMb).toLocaleString('en-US');
|
const usedMemoryInMB: string = Math.ceil((await osu.mem.info()).usedMemMb).toLocaleString('en-US');
|
||||||
@@ -97,28 +87,28 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(`**${embedOptions.icons.bot} Bot status**\n` + botStatusString)
|
.setDescription(`**${this.embedOptions.icons.bot} Bot status**\n` + botStatusString)
|
||||||
.addFields(
|
.addFields(
|
||||||
{
|
{
|
||||||
name: `**${embedOptions.icons.queue} Queue status**`,
|
name: `**${this.embedOptions.icons.queue} Queue status**`,
|
||||||
value: queueStatusString,
|
value: queueStatusString,
|
||||||
inline: false
|
inline: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `**${embedOptions.icons.server} System status**`,
|
name: `**${this.embedOptions.icons.server} System status**`,
|
||||||
value: systemStatusString,
|
value: systemStatusString,
|
||||||
inline: false
|
inline: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `**${embedOptions.icons.discord} Discord status**`,
|
name: `**${this.embedOptions.icons.discord} Discord status**`,
|
||||||
value: discordStatusString,
|
value: discordStatusString,
|
||||||
inline: false
|
inline: false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new StatusCommand();
|
||||||
@@ -13,33 +13,28 @@ import {
|
|||||||
StringSelectMenuBuilder,
|
StringSelectMenuBuilder,
|
||||||
StringSelectMenuOptionBuilder
|
StringSelectMenuOptionBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
|
||||||
import loggerModule from '../../../services/logger';
|
import {
|
||||||
import { EmbedOptions, FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
|
BaseSlashCommandInteraction,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
|
||||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||||
|
|
||||||
const command: BaseSlashCommandInteraction = {
|
class FiltersCommand extends BaseSlashCommandInteraction {
|
||||||
isNew: false,
|
constructor() {
|
||||||
isBeta: false,
|
const data = new SlashCommandBuilder()
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('filters')
|
.setName('filters')
|
||||||
.setDescription('Toggle various audio filters during playback.')
|
.setDescription('Toggle various audio filters during playback.');
|
||||||
.setDMPermission(false)
|
super(data);
|
||||||
.setNSFW(false),
|
}
|
||||||
execute: async ({ interaction, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
source: 'filters.js',
|
const { executionId, interaction } = params;
|
||||||
module: 'slashCommand',
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
name: '/filters',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -92,7 +87,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
.setCustomId('filters-disable-button')
|
.setCustomId('filters-disable-button')
|
||||||
.setLabel('Disable all filters')
|
.setLabel('Disable all filters')
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(embedOptions.icons.disable)
|
.setEmoji(this.embedOptions.icons.disable)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
|
|
||||||
const disableFiltersActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const disableFiltersActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||||
@@ -105,11 +100,11 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription('**Toggle filters**\nEnable or disable audio filters for playback from the menu.')
|
.setDescription('**Toggle filters**\nEnable or disable audio filters for playback from the menu.')
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
],
|
],
|
||||||
components: [filterActionRow, disableFiltersActionRow]
|
components: [filterActionRow, disableFiltersActionRow]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new FiltersCommand();
|
||||||
@@ -1,32 +1,24 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class LeaveCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('leave')
|
.setName('leave')
|
||||||
.setDescription('Clear the track queue and remove the bot from voice channel.')
|
.setDescription('Clear the track queue and remove the bot from voice channel.');
|
||||||
.setDMPermission(false)
|
super(data);
|
||||||
.setNSFW(false),
|
}
|
||||||
execute: async ({ interaction, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
source: 'leave.js',
|
const { executionId, interaction } = params;
|
||||||
module: 'slashCommand',
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
name: '/leave',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -61,15 +53,15 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!`
|
`**${this.embedOptions.icons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new LeaveCommand();
|
||||||
@@ -1,24 +1,18 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { BotOptions, EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class LoopCommand extends BaseSlashCommandInteraction {
|
||||||
const botOptions: BotOptions = config.get('botOptions');
|
constructor() {
|
||||||
|
const data = new SlashCommandBuilder()
|
||||||
const command: BaseSlashCommandInteraction = {
|
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('loop')
|
.setName('loop')
|
||||||
.setDescription('Toggle looping a track, the whole queue or autoplay.')
|
.setDescription('Toggle looping a track, the whole queue or autoplay.')
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false)
|
|
||||||
.addStringOption(() =>
|
.addStringOption(() =>
|
||||||
new SlashCommandStringOption()
|
new SlashCommandStringOption()
|
||||||
.setName('mode')
|
.setName('mode')
|
||||||
@@ -30,16 +24,13 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
{ name: 'Autoplay', value: '3' },
|
{ name: 'Autoplay', value: '3' },
|
||||||
{ name: 'Disabled', value: '0' }
|
{ name: 'Disabled', value: '0' }
|
||||||
)
|
)
|
||||||
),
|
);
|
||||||
execute: async ({ interaction, executionId }) => {
|
super(data);
|
||||||
const logger: Logger = loggerModule.child({
|
}
|
||||||
source: 'loop.js',
|
|
||||||
module: 'slashCommand',
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
name: '/loop',
|
const { executionId, interaction } = params;
|
||||||
executionId: executionId,
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -77,10 +68,10 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${
|
`**${
|
||||||
currentMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
|
currentMode === 3 ? this.embedOptions.icons.autoplay : this.embedOptions.icons.loop
|
||||||
} Current loop mode**\nThe looping mode is currently set to **\`${currentModeUserString}\`**.`
|
} Current loop mode**\nThe looping mode is currently set to **\`${currentModeUserString}\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -93,9 +84,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nLoop mode is already **\`${modeUserString}\`**.`
|
`**${this.embedOptions.icons.warning} Oops!**\nLoop mode is already **\`${modeUserString}\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -114,9 +105,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Uh-oh... Failed to change loop mode!**\nI tried to change the loop mode to **\`${modeUserString}\`**, but something went wrong.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect or the issue persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.error} Uh-oh... Failed to change loop mode!**\nI tried to change the loop mode to **\`${modeUserString}\`**, but something went wrong.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect or the issue persists, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -140,12 +131,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.success} Loop mode disabled**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${currentModeUserString} will no longer play on repeat!`
|
`**${this.embedOptions.icons.success} Loop mode disabled**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${currentModeUserString} will no longer play on repeat!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -159,12 +150,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.autoplaying} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nWhen the queue is empty, similar tracks will start playing!`
|
`**${this.embedOptions.icons.autoplaying} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nWhen the queue is empty, similar tracks will start playing!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -177,15 +168,15 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.looping} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${modeUserString} will now play on repeat!`
|
`**${this.embedOptions.icons.looping} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${modeUserString} will now play on repeat!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new LoopCommand();
|
||||||
@@ -1,32 +1,19 @@
|
|||||||
import config from 'config';
|
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
||||||
import { GuildQueue, Player, QueryType, useMainPlayer, useQueue } from 'discord-player';
|
import { GuildQueue, Player, QueryType, useMainPlayer, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
|
import {
|
||||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
BaseSlashCommandInteraction,
|
||||||
|
BaseSlashCommandParams,
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandReturnType
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
} from '../../../types/interactionTypes';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class LyricsCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const loggerTemplate: Logger = loggerModule.child({
|
const data = new SlashCommandBuilder()
|
||||||
source: 'lyrics.js',
|
|
||||||
module: 'slashCommand',
|
|
||||||
name: '/lyrics'
|
|
||||||
});
|
|
||||||
|
|
||||||
const command: BaseSlashCommandInteraction = {
|
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('lyrics')
|
.setName('lyrics')
|
||||||
.setDescription('Get lyrics from Genius for current or specified track.')
|
.setDescription('Get lyrics from Genius for current or specified track.')
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false)
|
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('query')
|
.setName('query')
|
||||||
@@ -35,13 +22,13 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
.setMinLength(2)
|
.setMinLength(2)
|
||||||
.setMaxLength(500)
|
.setMaxLength(500)
|
||||||
.setAutocomplete(true)
|
.setAutocomplete(true)
|
||||||
),
|
);
|
||||||
execute: async ({ interaction, executionId }) => {
|
super(data);
|
||||||
const logger: Logger = loggerTemplate.child({
|
}
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
guildId: interaction.guild?.id
|
const { executionId, interaction } = params;
|
||||||
});
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
|
|
||||||
const query: string = interaction.options.getString('query')!;
|
const query: string = interaction.options.getString('query')!;
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
@@ -84,9 +71,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} No search results found**\nThere was no search results found for query **${query}**.`
|
`**${this.embedOptions.icons.warning} No search results found**\nThere was no search results found for query **${query}**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -144,9 +131,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} No lyrics found**\nThere was no Genius lyrics found for track **${geniusSearchQuery}**.`
|
`**${this.embedOptions.icons.warning} No lyrics found**\nThere was no Genius lyrics found for track **${geniusSearchQuery}**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -166,12 +153,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.queue} Showing lyrics**\n` +
|
`**${this.embedOptions.icons.queue} Showing lyrics**\n` +
|
||||||
`**Track: [${lyricsResult.title}](${lyricsResult.url})**\n` +
|
`**Track: [${lyricsResult.title}](${lyricsResult.url})**\n` +
|
||||||
`**Artist: [${lyricsResult.artist.name}](${lyricsResult.artist.url})**` +
|
`**Artist: [${lyricsResult.artist.name}](${lyricsResult.artist.url})**` +
|
||||||
`\n\n\`\`\`fix\n${message}\`\`\``
|
`\n\n\`\`\`fix\n${message}\`\`\``
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
continue;
|
continue;
|
||||||
@@ -181,7 +168,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(`\`\`\`fix\n${message}\`\`\``)
|
.setDescription(`\`\`\`fix\n${message}\`\`\``)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -195,15 +182,15 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.queue} Showing lyrics**\n` +
|
`**${this.embedOptions.icons.queue} Showing lyrics**\n` +
|
||||||
`**Track: [${lyricsResult.title}](${lyricsResult.url})**\n` +
|
`**Track: [${lyricsResult.title}](${lyricsResult.url})**\n` +
|
||||||
`**Artist: [${lyricsResult.artist.name}](${lyricsResult.artist.url})**` +
|
`**Artist: [${lyricsResult.artist.name}](${lyricsResult.artist.url})**` +
|
||||||
`\n\n\`\`\`fix\n${lyricsResult.lyrics}\`\`\``
|
`\n\n\`\`\`fix\n${lyricsResult.lyrics}\`\`\``
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new LyricsCommand();
|
||||||
@@ -10,34 +10,29 @@ import {
|
|||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
|
import { PlayerOptions } from '../../../types/configTypes';
|
||||||
import loggerModule from '../../../services/logger';
|
import {
|
||||||
import { BaseSlashCommandInteraction, TrackMetadata } from '../../../types/interactionTypes';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType,
|
||||||
|
TrackMetadata
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
|
||||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||||
|
|
||||||
const command: BaseSlashCommandInteraction = {
|
class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||||
isNew: false,
|
constructor() {
|
||||||
isBeta: false,
|
const data = new SlashCommandBuilder()
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('nowplaying')
|
.setName('nowplaying')
|
||||||
.setDescription('Show information about the track currently playing.')
|
.setDescription('Show information about the track currently playing.');
|
||||||
.setDMPermission(false)
|
super(data);
|
||||||
.setNSFW(false),
|
}
|
||||||
execute: async ({ interaction, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
source: 'nowplaying.js',
|
const { executionId, interaction } = params;
|
||||||
module: 'slashCommand',
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
name: '/nowplaying',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -64,11 +59,11 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const sourceIcons: Map<string, string> = new Map([
|
const sourceIcons: Map<string, string> = new Map([
|
||||||
['youtube', embedOptions.icons.sourceYouTube],
|
['youtube', this.embedOptions.icons.sourceYouTube],
|
||||||
['soundcloud', embedOptions.icons.sourceSoundCloud],
|
['soundcloud', this.embedOptions.icons.sourceSoundCloud],
|
||||||
['spotify', embedOptions.icons.sourceSpotify],
|
['spotify', this.embedOptions.icons.sourceSpotify],
|
||||||
['apple_music', embedOptions.icons.sourceAppleMusic],
|
['apple_music', this.embedOptions.icons.sourceAppleMusic],
|
||||||
['arbitrary', embedOptions.icons.sourceArbitrary]
|
['arbitrary', this.embedOptions.icons.sourceArbitrary]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const currentTrack: Track = queue.currentTrack!;
|
const currentTrack: Track = queue.currentTrack!;
|
||||||
@@ -106,7 +101,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentTrack.raw.live) {
|
if (currentTrack.raw.live) {
|
||||||
bar = `${embedOptions.icons.liveTrack} **\`LIVE\`** - Playing continuously from live source.`;
|
bar = `${this.embedOptions.icons.liveTrack} **\`LIVE\`** - Playing continuously from live source.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const customId: string = `nowplaying-skip-button_${currentTrack.id}`;
|
const customId: string = `nowplaying-skip-button_${currentTrack.id}`;
|
||||||
@@ -116,7 +111,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
.setCustomId(customId)
|
.setCustomId(customId)
|
||||||
.setLabel('Skip track')
|
.setLabel('Skip track')
|
||||||
.setStyle(ButtonStyle.Secondary)
|
.setStyle(ButtonStyle.Secondary)
|
||||||
.setEmoji(embedOptions.icons.nextTrack)
|
.setEmoji(this.embedOptions.icons.nextTrack)
|
||||||
.toJSON();
|
.toJSON();
|
||||||
|
|
||||||
const nowPlayingActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
const nowPlayingActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||||
@@ -141,12 +136,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
||||||
iconURL: interaction.guild!.iconURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
(queue.node.isPaused()
|
(queue.node.isPaused()
|
||||||
? '**Currently Paused**\n'
|
? '**Currently Paused**\n'
|
||||||
: `**${embedOptions.icons.audioPlaying} Now Playing**\n`) +
|
: `**${this.embedOptions.icons.audioPlaying} Now Playing**\n`) +
|
||||||
`**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**` +
|
`**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**` +
|
||||||
`\nRequested by: <@${currentTrack.requestedBy?.id}>` +
|
`\nRequested by: <@${currentTrack.requestedBy?.id}>` +
|
||||||
`\n ${bar}\n\n` +
|
`\n ${bar}\n\n` +
|
||||||
@@ -154,7 +149,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
queue.repeatMode === 0
|
queue.repeatMode === 0
|
||||||
? ''
|
? ''
|
||||||
: `**${
|
: `**${
|
||||||
queue.repeatMode === 3 ? embedOptions.icons.autoplay : embedOptions.icons.loop
|
queue.repeatMode === 3
|
||||||
|
? this.embedOptions.icons.autoplay
|
||||||
|
: this.embedOptions.icons.loop
|
||||||
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
|
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
|
||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
@@ -181,11 +178,11 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
text: queueLength ? `${queueLength} other tracks in the queue...` : ' '
|
text: queueLength ? `${queueLength} other tracks in the queue...` : ' '
|
||||||
})
|
})
|
||||||
.setThumbnail(queue.currentTrack!.thumbnail)
|
.setThumbnail(queue.currentTrack!.thumbnail)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
],
|
],
|
||||||
components: [nowPlayingActionRow as APIActionRowComponent<APIMessageActionRowComponent>]
|
components: [nowPlayingActionRow as APIActionRowComponent<APIMessageActionRowComponent>]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new NowPlayingCommand();
|
||||||
@@ -1,32 +1,23 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import loggerModule from '../../../services/logger';
|
import {
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandInteraction,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class PauseCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
|
const data = new SlashCommandBuilder().setName('pause').setDescription('Pause or resume the current track.');
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
|
||||||
const command: BaseSlashCommandInteraction = {
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
isNew: false,
|
const { executionId, interaction } = params;
|
||||||
isBeta: false,
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('pause')
|
|
||||||
.setDescription('Pause or resume the current track.')
|
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false),
|
|
||||||
execute: async ({ interaction, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
|
||||||
source: 'pause.js',
|
|
||||||
module: 'slashCommand',
|
|
||||||
name: '/pause',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -51,7 +42,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
: `\`${currentTrack.duration}\``;
|
: `\`${currentTrack.duration}\``;
|
||||||
|
|
||||||
if (currentTrack.raw.live) {
|
if (currentTrack.raw.live) {
|
||||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||||
}
|
}
|
||||||
|
|
||||||
// change paused state to opposite of current state
|
// change paused state to opposite of current state
|
||||||
@@ -72,18 +63,18 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.pauseResumed} ${
|
`**${this.embedOptions.icons.pauseResumed} ${
|
||||||
queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
|
queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
|
||||||
}**\n**${durationFormat} [${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**`
|
}**\n**${durationFormat} [${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**`
|
||||||
)
|
)
|
||||||
.setThumbnail(currentTrack.thumbnail)
|
.setThumbnail(currentTrack.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new PauseCommand();
|
||||||
@@ -1,33 +1,24 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
|
import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
|
import { PlayerOptions } from '../../../types/configTypes';
|
||||||
import loggerModule from '../../../services/logger';
|
import {
|
||||||
import { CustomError, BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandInteraction,
|
||||||
import { BotOptions, EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType,
|
||||||
|
CustomError
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { cannotJoinVoiceOrTalk } from '../../../utils/validation/permissionValidator';
|
import { cannotJoinVoiceOrTalk } from '../../../utils/validation/permissionValidator';
|
||||||
import { transformQuery } from '../../../utils/validation/searchQueryValidator';
|
import { transformQuery } from '../../../utils/validation/searchQueryValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
import { Logger } from 'pino';
|
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
|
||||||
const botOptions: BotOptions = config.get('botOptions');
|
|
||||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||||
|
|
||||||
const loggerTemplate: Logger = loggerModule.child({
|
class PlayCommand extends BaseSlashCommandInteraction {
|
||||||
source: 'play.js',
|
constructor() {
|
||||||
module: 'slashCommand',
|
const data = new SlashCommandBuilder()
|
||||||
name: '/play'
|
|
||||||
});
|
|
||||||
|
|
||||||
const command: BaseSlashCommandInteraction = {
|
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('play')
|
.setName('play')
|
||||||
.setDescription('Add a track or playlist to the queue by searching or url.')
|
.setDescription('Add a track or playlist to the queue by searching or url.')
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false)
|
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('query')
|
.setName('query')
|
||||||
@@ -36,13 +27,13 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
.setMinLength(2)
|
.setMinLength(2)
|
||||||
.setMaxLength(500)
|
.setMaxLength(500)
|
||||||
.setAutocomplete(true)
|
.setAutocomplete(true)
|
||||||
),
|
);
|
||||||
execute: async ({ interaction, executionId }) => {
|
super(data);
|
||||||
const logger = loggerTemplate.child({
|
}
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
guildId: interaction.guild?.id
|
const { executionId, interaction } = params;
|
||||||
});
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
|
|
||||||
let queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
let queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
if (queue && (await notInSameVoiceChannel({ interaction, queue, executionId }))) {
|
if (queue && (await notInSameVoiceChannel({ interaction, queue, executionId }))) {
|
||||||
@@ -83,9 +74,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} No track found**\nNo results found for **\`${transformedQuery}\`**.\n\nIf you specified a URL, please make sure it is valid and public.`
|
`**${this.embedOptions.icons.warning} No track found**\nNo results found for **\`${transformedQuery}\`**.\n\nIf you specified a URL, please make sure it is valid and public.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -101,9 +92,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Playlist too large**\nThis playlist is too large to be added to the queue.\n\nThe maximum amount of tracks that can be added to the queue is **${playerOptions.maxQueueSize}**.`
|
`**${this.embedOptions.icons.warning} Playlist too large**\nThis playlist is too large to be added to the queue.\n\nThe maximum amount of tracks that can be added to the queue is **${playerOptions.maxQueueSize}**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -145,9 +136,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Cannot retrieve audio for track**\nThis audio source is age restricted and requires login to access. Because of this I cannot retrieve the audio for the track.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.warning} Cannot retrieve audio for track**\nThis audio source is age restricted and requires login to access. Because of this I cannot retrieve the audio for the track.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -162,9 +153,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Cannot retrieve audio for track**\nThis audio source cannot be played as the video source has a warning for graphic or sensistive topics. It requires a manual confirmation to to play the video, and because of this I am unable to extract the audio for this source.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.warning} Cannot retrieve audio for track**\nThis audio source cannot be played as the video source has a warning for graphic or sensistive topics. It requires a manual confirmation to to play the video, and because of this I am unable to extract the audio for this source.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -183,9 +174,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nAfter finding a result, I was unable to retrieve audio for the track.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.error} Uh-oh... Failed to add track!**\nAfter finding a result, I was unable to retrieve audio for the track.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -199,9 +190,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nSomething unexpected happened and the operation was cancelled.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.error} Uh-oh... Failed to add track!**\nSomething unexpected happened and the operation was cancelled.\n\nYou can try to perform the command again.\n\n_If you think this message is incorrect, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -225,9 +216,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Uh-oh... Failed to add track!**\nThere was an issue adding this track to the queue.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${botOptions.serverInviteUrl})**._`
|
`**${this.embedOptions.icons.error} Uh-oh... Failed to add track!**\nThere was an issue adding this track to the queue.\n\nYou can try to perform the command again.\n\n_If this problem persists, please submit a bug report in the **[support server](${this.botOptions.serverInviteUrl})**._`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -243,14 +234,14 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
`Track found but source is arbitrary or missing thumbnail. Using fallback thumbnail url. Query: '${query}'.`
|
`Track found but source is arbitrary or missing thumbnail. Using fallback thumbnail url. Query: '${query}'.`
|
||||||
);
|
);
|
||||||
track.thumbnail = embedOptions.info.fallbackThumbnailUrl;
|
track.thumbnail = this.embedOptions.info.fallbackThumbnailUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
let durationFormat =
|
let durationFormat =
|
||||||
Number(track.raw.duration) === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``;
|
Number(track.raw.duration) === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``;
|
||||||
|
|
||||||
if (track.raw.live) {
|
if (track.raw.live) {
|
||||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchResult.playlist && searchResult.tracks.length > 1) {
|
if (searchResult.playlist && searchResult.tracks.length > 1) {
|
||||||
@@ -270,17 +261,17 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
|
`**${this.embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
|
||||||
track.title
|
track.title
|
||||||
}](${track.raw.url ?? track.url})**\n\nAnd **${
|
}](${track.raw.url ?? track.url})**\n\nAnd **${
|
||||||
searchResult.tracks.length - 1
|
searchResult.tracks.length - 1
|
||||||
}** more tracks... **\`/queue\`** to view all.`
|
}** more tracks... **\`/queue\`** to view all.`
|
||||||
)
|
)
|
||||||
.setThumbnail(track.thumbnail)
|
.setThumbnail(track.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -302,15 +293,15 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.audioStartedPlaying} Started playing**\n**${durationFormat} [${
|
`**${this.embedOptions.icons.audioStartedPlaying} Started playing**\n**${durationFormat} [${
|
||||||
track.title
|
track.title
|
||||||
}](${track.raw.url ?? track.url})**`
|
}](${track.raw.url ?? track.url})**`
|
||||||
)
|
)
|
||||||
.setThumbnail(track.thumbnail)
|
.setThumbnail(track.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -331,18 +322,18 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`${embedOptions.icons.success} **Added to queue**\n**${durationFormat} [${track.title}](${
|
`${this.embedOptions.icons.success} **Added to queue**\n**${durationFormat} [${track.title}](${
|
||||||
track.raw.url ?? track.url
|
track.raw.url ?? track.url
|
||||||
})**`
|
})**`
|
||||||
)
|
)
|
||||||
.setThumbnail(track.thumbnail)
|
.setThumbnail(track.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new PlayCommand();
|
||||||
@@ -1,34 +1,32 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { GuildQueue, PlayerTimestamp, Track, useQueue } from 'discord-player';
|
import { GuildQueue, PlayerTimestamp, Track, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import loggerModule from '../../../services/logger';
|
|
||||||
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
import {
|
||||||
|
BaseSlashCommandInteraction,
|
||||||
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||||
|
|
||||||
const command: BaseSlashCommandInteraction = {
|
class QueueCommand extends BaseSlashCommandInteraction {
|
||||||
isNew: false,
|
constructor() {
|
||||||
isBeta: false,
|
const data = new SlashCommandBuilder()
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('queue')
|
.setName('queue')
|
||||||
.setDescription('Show the list of tracks added to the queue.')
|
.setDescription('Show the list of tracks added to the queue.')
|
||||||
.setDMPermission(false)
|
.addNumberOption((option) =>
|
||||||
.setNSFW(false)
|
option.setName('page').setDescription('Page number of the queue').setMinValue(1)
|
||||||
.addNumberOption((option) => option.setName('page').setDescription('Page number of the queue').setMinValue(1)),
|
);
|
||||||
execute: async ({ interaction, executionId }) => {
|
super(data);
|
||||||
const logger: Logger = loggerModule.child({
|
}
|
||||||
source: 'queue.js',
|
|
||||||
module: 'slashCommand',
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
name: '/queue',
|
const { executionId, interaction } = params;
|
||||||
executionId: executionId,
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -58,11 +56,11 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nPage **\`${
|
`**${this.embedOptions.icons.warning} Oops!**\nPage **\`${
|
||||||
pageIndex + 1
|
pageIndex + 1
|
||||||
}\`** is not a valid page number.\n\nThere are only a total of **\`${totalPages}\`** pages in the queue.`
|
}\`** is not a valid page number.\n\nThere are only a total of **\`${totalPages}\`** pages in the queue.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -78,7 +76,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
Number(track.raw.duration) === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``;
|
Number(track.raw.duration) === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``;
|
||||||
|
|
||||||
if (track.raw.live) {
|
if (track.raw.live) {
|
||||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `**${pageIndex * 10 + index + 1}.** **${durationFormat} [${track.title}](${
|
return `**${pageIndex * 10 + index + 1}.** **${durationFormat} [${track.title}](${
|
||||||
@@ -116,15 +114,16 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
||||||
iconURL: interaction.guild!.iconURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`${repeatModeString}` + `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
`${repeatModeString}` +
|
||||||
|
`**${this.embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
||||||
)
|
)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
|
text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
|
||||||
})
|
})
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -144,7 +143,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentTrack.raw.live) {
|
if (currentTrack.raw.live) {
|
||||||
bar = `${embedOptions.icons.liveTrack} **\`LIVE\`** - Playing continuously from live source.`;
|
bar = `${this.embedOptions.icons.liveTrack} **\`LIVE\`** - Playing continuously from live source.`;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug('Responding with info embed.');
|
logger.debug('Responding with info embed.');
|
||||||
@@ -153,27 +152,27 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
||||||
iconURL: interaction.guild!.iconURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.audioPlaying} Now playing**\n` +
|
`**${this.embedOptions.icons.audioPlaying} Now playing**\n` +
|
||||||
(currentTrack
|
(currentTrack
|
||||||
? `**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**`
|
? `**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**`
|
||||||
: 'None') +
|
: 'None') +
|
||||||
`\nRequested by: <@${currentTrack.requestedBy?.id}>` +
|
`\nRequested by: <@${currentTrack.requestedBy?.id}>` +
|
||||||
`\n ${bar}\n\n` +
|
`\n ${bar}\n\n` +
|
||||||
`${repeatModeString}` +
|
`${repeatModeString}` +
|
||||||
`**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
`**${this.embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
||||||
)
|
)
|
||||||
.setThumbnail(currentTrack.thumbnail)
|
.setThumbnail(currentTrack.thumbnail)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
|
text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
|
||||||
})
|
})
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new QueueCommand();
|
||||||
@@ -1,39 +1,31 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class RemoveCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('remove')
|
.setName('remove')
|
||||||
.setDescription('Remove a specific track from the queue.')
|
.setDescription('Remove a specific track from the queue')
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false)
|
|
||||||
.addNumberOption((option) =>
|
.addNumberOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('tracknumber')
|
.setName('tracknumber')
|
||||||
.setDescription('Track number to remove from queue.')
|
.setDescription('Track number to remove from queue.')
|
||||||
.setMinValue(1)
|
.setMinValue(1)
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
),
|
);
|
||||||
execute: async ({ interaction, executionId }) => {
|
super(data);
|
||||||
const logger: Logger = loggerModule.child({
|
}
|
||||||
source: 'remove.js',
|
|
||||||
module: 'slashCommand',
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
name: '/remove',
|
const { executionId, interaction } = params;
|
||||||
executionId: executionId,
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -59,9 +51,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nTrack **\`${removeTrackNumber}\`** is not a valid track number. There are a total of **\`${queue.tracks.data.length}\`** tracks in the queue.\n\nView tracks added to the queue with **\`/queue\`**.`
|
`**${this.embedOptions.icons.warning} Oops!**\nTrack **\`${removeTrackNumber}\`** is not a valid track number. There are a total of **\`${queue.tracks.data.length}\`** tracks in the queue.\n\nView tracks added to the queue with **\`/queue\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -75,7 +67,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
: `\`${removedTrack.duration}\``;
|
: `\`${removedTrack.duration}\``;
|
||||||
|
|
||||||
if (removedTrack.raw.live) {
|
if (removedTrack.raw.live) {
|
||||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||||
}
|
}
|
||||||
|
|
||||||
let authorName: string;
|
let authorName: string;
|
||||||
@@ -92,18 +84,18 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.success} Removed track**\n**${durationFormat} [${removedTrack.title}](${
|
`**${this.embedOptions.icons.success} Removed track**\n**${durationFormat} [${
|
||||||
removedTrack.raw.url ?? removedTrack.url
|
removedTrack.title
|
||||||
})**`
|
}](${removedTrack.raw.url ?? removedTrack.url})**`
|
||||||
)
|
)
|
||||||
.setThumbnail(removedTrack.thumbnail)
|
.setThumbnail(removedTrack.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new RemoveCommand();
|
||||||
@@ -1,38 +1,30 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class SeekCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('seek')
|
.setName('seek')
|
||||||
.setDescription('Seek to a specified duration in the current track.')
|
.setDescription('Seek to a specified duration in the current track.')
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false)
|
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('duration')
|
.setName('duration')
|
||||||
.setDescription('Duration in format 00:00:00 (HH:mm:ss) to seek to.')
|
.setDescription('Duration in format 00:00:00 (HH:mm:ss) to seek to.')
|
||||||
.setRequired(true)
|
.setRequired(true)
|
||||||
),
|
);
|
||||||
execute: async ({ interaction, executionId }) => {
|
super(data);
|
||||||
const logger: Logger = loggerModule.child({
|
}
|
||||||
source: 'seek.js',
|
|
||||||
module: 'slashCommand',
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
name: '/seek',
|
const { executionId, interaction } = params;
|
||||||
executionId: executionId,
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -78,12 +70,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, **\`${durationString}\`**.\n\nPlease use the format **\`HH:mm:ss\`**, **\`mm:ss\`** or **\`ss\`**, where **\`HH\`** is hours, **\`mm\`** is minutes and **\`ss\`** is seconds.\n\n**Examples:**\n` +
|
`**${this.embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, **\`${durationString}\`**.\n\nPlease use the format **\`HH:mm:ss\`**, **\`mm:ss\`** or **\`ss\`**, where **\`HH\`** is hours, **\`mm\`** is minutes and **\`ss\`** is seconds.\n\n**Examples:**\n` +
|
||||||
'- **`/seek`** **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
|
'- **`/seek`** **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
|
||||||
'- **`/seek`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
'- **`/seek`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
||||||
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -100,12 +92,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, **\`${durationString}\`**.\n\nPlease use the format **\`HH:mm:ss\`**, **\`mm:ss\`** or **\`ss\`**, where **\`HH\`** is hours, **\`mm\`** is minutes and **\`ss\`** is seconds.\n\n**Examples:**\n` +
|
`**${this.embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, **\`${durationString}\`**.\n\nPlease use the format **\`HH:mm:ss\`**, **\`mm:ss\`** or **\`ss\`**, where **\`HH\`** is hours, **\`mm\`** is minutes and **\`ss\`** is seconds.\n\n**Examples:**\n` +
|
||||||
'- **`/seek`** **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
|
'- **`/seek`** **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
|
||||||
'- **`/seek`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
'- **`/seek`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
||||||
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -123,12 +115,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, **\`${durationString}\`**.\n\nPlease use the format **\`HH:mm:ss\`**, **\`mm:ss\`** or **\`ss\`**, where **\`HH\`** is hours, **\`mm\`** is minutes and **\`ss\`** is seconds.\n\n**Examples:**\n` +
|
`**${this.embedOptions.icons.warning} Oops!**\nYou entered an invalid duration format, **\`${durationString}\`**.\n\nPlease use the format **\`HH:mm:ss\`**, **\`mm:ss\`** or **\`ss\`**, where **\`HH\`** is hours, **\`mm\`** is minutes and **\`ss\`** is seconds.\n\n**Examples:**\n` +
|
||||||
'- **`/seek`** **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
|
'- **`/seek`** **`1:24:12`** - Seek to 1 hour, 24 minutes and 12 seconds.\n' +
|
||||||
'- **`/seek`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
'- **`/seek`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
||||||
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -146,12 +138,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${
|
`**${
|
||||||
embedOptions.icons.warning
|
this.embedOptions.icons.warning
|
||||||
} Oops!**\nYou entered **\`${durationString}\`**, which is a duration that is longer than the duration for the current track.\n\nPlease try a duration that is less than the duration of the track (**\`${
|
} Oops!**\nYou entered **\`${durationString}\`**, which is a duration that is longer than the duration for the current track.\n\nPlease try a duration that is less than the duration of the track (**\`${
|
||||||
queue.currentTrack!.duration
|
queue.currentTrack!.duration
|
||||||
}\`**).`
|
}\`**).`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -173,16 +165,16 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.`
|
`**${this.embedOptions.icons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.`
|
||||||
)
|
)
|
||||||
.setThumbnail(queue.currentTrack!.thumbnail)
|
.setThumbnail(queue.currentTrack!.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new SeekCommand();
|
||||||
@@ -1,32 +1,24 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueIsEmpty } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueIsEmpty } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class ShuffleCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('shuffle')
|
.setName('shuffle')
|
||||||
.setDescription('Shuffle tracks in the queue randomly.')
|
.setDescription('Shuffle tracks in the queue randomly.');
|
||||||
.setDMPermission(false)
|
super(data);
|
||||||
.setNSFW(false),
|
}
|
||||||
execute: async ({ interaction, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
source: 'shuffle.js',
|
const { executionId, interaction } = params;
|
||||||
module: 'slashCommand',
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
name: '/shuffle',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -60,15 +52,15 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.shuffled} Shuffled queue tracks**\nThe **${queue.tracks.data.length}** tracks in the queue has been shuffled.\n\nView the new queue order with **\`/queue\`**.`
|
`**${this.embedOptions.icons.shuffled} Shuffled queue tracks**\nThe **${queue.tracks.data.length}** tracks in the queue has been shuffled.\n\nView the new queue order with **\`/queue\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new ShuffleCommand();
|
||||||
@@ -1,35 +1,27 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class SkipCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isNew: false,
|
.setName('test')
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('skip')
|
|
||||||
.setDescription('Skip current or specified track.')
|
.setDescription('Skip current or specified track.')
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false)
|
|
||||||
.addNumberOption((option) =>
|
.addNumberOption((option) =>
|
||||||
option.setName('tracknumber').setDescription('Track number to skip to in the queue.').setMinValue(1)
|
option.setName('tracknumber').setDescription('Track number to skip to in the queue.').setMinValue(1)
|
||||||
),
|
);
|
||||||
execute: async ({ interaction, executionId }) => {
|
super(data);
|
||||||
const logger: Logger = loggerModule.child({
|
}
|
||||||
source: 'skip.js',
|
|
||||||
module: 'slashCommand',
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
name: '/skip',
|
const { executionId, interaction } = params;
|
||||||
executionId: executionId,
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -57,9 +49,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nThere are only **\`${queue.tracks.data.length}\`** tracks in the queue. You cannot skip to track **\`${skipToTrack}\`**.\n\nView tracks added to the queue with **\`/queue\`**.`
|
`**${this.embedOptions.icons.warning} Oops!**\nThere are only **\`${queue.tracks.data.length}\`** tracks in the queue. You cannot skip to track **\`${skipToTrack}\`**.\n\nView tracks added to the queue with **\`/queue\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -72,7 +64,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
: `\`${skippedTrack.duration}\``;
|
: `\`${skippedTrack.duration}\``;
|
||||||
|
|
||||||
if (skippedTrack.raw.live) {
|
if (skippedTrack.raw.live) {
|
||||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||||
}
|
}
|
||||||
|
|
||||||
queue.node.skipTo(skipToTrack - 1);
|
queue.node.skipTo(skipToTrack - 1);
|
||||||
@@ -92,15 +84,15 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||||
skippedTrack.title
|
skippedTrack.title
|
||||||
}](${skippedTrack.raw.url ?? skippedTrack.url})**`
|
}](${skippedTrack.raw.url ?? skippedTrack.url})**`
|
||||||
)
|
)
|
||||||
.setThumbnail(skippedTrack.thumbnail)
|
.setThumbnail(skippedTrack.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -113,9 +105,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
|
`**${this.embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -128,7 +120,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
: `\`${skippedTrack.duration}\``;
|
: `\`${skippedTrack.duration}\``;
|
||||||
|
|
||||||
if (skippedTrack.raw.live) {
|
if (skippedTrack.raw.live) {
|
||||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||||
}
|
}
|
||||||
queue.node.skip();
|
queue.node.skip();
|
||||||
logger.debug('Skipped current track.');
|
logger.debug('Skipped current track.');
|
||||||
@@ -156,10 +148,10 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||||
skippedTrack.title
|
skippedTrack.title
|
||||||
}](${skippedTrack.raw.url ?? skippedTrack.url})**` +
|
}](${skippedTrack.raw.url ?? skippedTrack.url})**` +
|
||||||
`${
|
`${
|
||||||
@@ -167,17 +159,17 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
? ''
|
? ''
|
||||||
: `\n\n**${
|
: `\n\n**${
|
||||||
queue.repeatMode === 3
|
queue.repeatMode === 3
|
||||||
? embedOptions.icons.autoplaying
|
? this.embedOptions.icons.autoplaying
|
||||||
: embedOptions.icons.looping
|
: this.embedOptions.icons.looping
|
||||||
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
|
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
|
||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
.setThumbnail(skippedTrack.thumbnail)
|
.setThumbnail(skippedTrack.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new SkipCommand();
|
||||||
@@ -1,32 +1,24 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class StopCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('stop')
|
.setName('stop')
|
||||||
.setDescription('Stop playing audio and clear the track queue.')
|
.setDescription('Stop playing audio and clear the track queue.');
|
||||||
.setDMPermission(false)
|
super(data);
|
||||||
.setNSFW(false),
|
}
|
||||||
execute: async ({ interaction, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
source: 'stop.js',
|
const { executionId, interaction } = params;
|
||||||
module: 'slashCommand',
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
name: '/stop',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -63,15 +55,15 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.success} Stopped playing**\nStopped playing audio and cleared the track queue.\n\nTo play more music, use the **\`/play\`** command!`
|
`**${this.embedOptions.icons.success} Stopped playing**\nStopped playing audio and cleared the track queue.\n\nTo play more music, use the **\`/play\`** command!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new StopCommand();
|
||||||
@@ -15,12 +15,9 @@ class TestCommand extends BaseSlashCommandInteraction {
|
|||||||
|
|
||||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
const { executionId, interaction } = params;
|
const { executionId, interaction } = params;
|
||||||
const logger = this.getLogger('test.js', executionId, interaction);
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
// logic
|
||||||
return await interaction.editReply({
|
|
||||||
embeds: [new EmbedBuilder().setDescription(`Success reply from command '${this.commandName}'.`).setColor(this.embedOptions.colors.success)]
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,39 +1,31 @@
|
|||||||
import config from 'config';
|
|
||||||
import { GuildQueue, useQueue } from 'discord-player';
|
import { GuildQueue, useQueue } from 'discord-player';
|
||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class VolumeCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('volume')
|
.setName('volume')
|
||||||
.setDescription('Show or set the playback volume for tracks.')
|
.setDescription('Show or set the playback volume for tracks.')
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false)
|
|
||||||
.addNumberOption((option) =>
|
.addNumberOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('percentage')
|
.setName('percentage')
|
||||||
.setDescription('Set volume percentage from 1% to 100%.')
|
.setDescription('Set volume percentage from 1% to 100%.')
|
||||||
.setMinValue(0)
|
.setMinValue(0)
|
||||||
.setMaxValue(100)
|
.setMaxValue(100)
|
||||||
),
|
);
|
||||||
execute: async ({ interaction, executionId }) => {
|
super(data);
|
||||||
const logger: Logger = loggerModule.child({
|
}
|
||||||
source: 'volume.js',
|
|
||||||
module: 'slashCommand',
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
name: '/volume',
|
const { executionId, interaction } = params;
|
||||||
executionId: executionId,
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||||
|
|
||||||
@@ -62,10 +54,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${
|
`**${
|
||||||
currentVolume === 0 ? embedOptions.icons.volumeIsMuted : embedOptions.icons.volume
|
currentVolume === 0
|
||||||
|
? this.embedOptions.icons.volumeIsMuted
|
||||||
|
: this.embedOptions.icons.volume
|
||||||
} Playback volume**\nThe playback volume is currently set to **\`${currentVolume}%\`**.`
|
} Playback volume**\nThe playback volume is currently set to **\`${currentVolume}%\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else if (volume > 100 || volume < 0) {
|
} else if (volume > 100 || volume < 0) {
|
||||||
@@ -76,9 +70,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nYou cannot set the volume to **\`${volume}%\`**, please pick a value betwen **\`1%\`** and **\`100%\`**.`
|
`**${this.embedOptions.icons.warning} Oops!**\nYou cannot set the volume to **\`${volume}%\`**, please pick a value betwen **\`1%\`** and **\`100%\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -100,12 +94,12 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to **\`${volume}%\`**.`
|
`**${this.embedOptions.icons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to **\`${volume}%\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -116,16 +110,16 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.volumeChanged} Volume changed**\nPlayback volume has been changed to **\`${volume}%\`**.`
|
`**${this.embedOptions.icons.volumeChanged} Volume changed**\nPlayback volume has been changed to **\`${volume}%\`**.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new VolumeCommand();
|
||||||
@@ -1,31 +1,22 @@
|
|||||||
import config from 'config';
|
|
||||||
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import {
|
||||||
import loggerModule from '../../../services/logger';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class GuildsCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isSystemCommand: true,
|
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('guilds')
|
.setName('guilds')
|
||||||
.setDescription('Show list of guilds where bot is added.')
|
.setDescription('Show list of guilds where bot is added.');
|
||||||
.setDMPermission(false)
|
super(data);
|
||||||
.setNSFW(false),
|
}
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
source: 'guilds.js',
|
const { executionId, interaction, client } = params;
|
||||||
module: 'slashCommand',
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
name: '/guilds',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
if (await notValidGuildId({ interaction, executionId })) {
|
if (await notValidGuildId({ interaction, executionId })) {
|
||||||
return;
|
return;
|
||||||
@@ -35,8 +26,8 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
let totalGuildCount: number = 0;
|
let totalGuildCount: number = 0;
|
||||||
|
|
||||||
logger.debug('Fetching guilds from all shards.');
|
logger.debug('Fetching guilds from all shards.');
|
||||||
await client!.shard!
|
await client!
|
||||||
.broadcastEval((c) => {
|
.shard!.broadcastEval((c) => {
|
||||||
return c.guilds.cache.map((guild) => {
|
return c.guilds.cache.map((guild) => {
|
||||||
return guild;
|
return guild;
|
||||||
});
|
});
|
||||||
@@ -64,7 +55,7 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
const totalMemberCount: number = shardGuilds.reduce((a, b) => a + b.memberCount, 0);
|
const totalMemberCount: number = shardGuilds.reduce((a, b) => a + b.memberCount, 0);
|
||||||
|
|
||||||
let embedDescription =
|
let embedDescription =
|
||||||
`**${embedOptions.icons.bot} ${
|
`**${this.embedOptions.icons.bot} ${
|
||||||
totalGuildCount < 25 ? `Top ${totalGuildCount} guilds` : 'Top 25 guilds'
|
totalGuildCount < 25 ? `Top ${totalGuildCount} guilds` : 'Top 25 guilds'
|
||||||
} by member count (${totalGuildCount} total)**\n${guildListFormatted}` +
|
} by member count (${totalGuildCount} total)**\n${guildListFormatted}` +
|
||||||
`\n\n**Total members:** **\`${totalMemberCount}\`**`;
|
`\n\n**Total members:** **\`${totalMemberCount}\`**`;
|
||||||
@@ -78,9 +69,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
|
|
||||||
logger.debug('Responding with info embed.');
|
logger.debug('Responding with info embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(embedOptions.colors.info)]
|
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(this.embedOptions.colors.info)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new GuildsCommand();
|
||||||
@@ -1,32 +1,21 @@
|
|||||||
import config from 'config';
|
|
||||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import loggerModule from '../../../services/logger';
|
|
||||||
import { ExtendedClient } from '../../../types/clientTypes';
|
import { ExtendedClient } from '../../../types/clientTypes';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import {
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandInteraction,
|
||||||
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class ReloadCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
|
const data = new SlashCommandBuilder().setName('reload').setDescription('Reload the bot commands.');
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
|
||||||
const command: BaseSlashCommandInteraction = {
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
isSystemCommand: true,
|
const { executionId, interaction, client } = params;
|
||||||
isNew: false,
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('reload')
|
|
||||||
.setDescription('Reload the bot commands.')
|
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false),
|
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
|
||||||
source: 'reload.js',
|
|
||||||
module: 'slashCommand',
|
|
||||||
name: '/reload',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
if (await notValidGuildId({ interaction, executionId })) {
|
if (await notValidGuildId({ interaction, executionId })) {
|
||||||
return;
|
return;
|
||||||
@@ -53,9 +42,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
|
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Oops!**\n_Hmm.._ It seems I am unable to reload commands across shards.`
|
`**${this.embedOptions.icons.error} Oops!**\n_Hmm.._ It seems I am unable to reload commands across shards.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -66,13 +55,14 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
return `- **\`/${command.data.name}\`** ${params}- ${command.data.description}`;
|
return `- **\`/${command.data.name}\`** ${params}- ${command.data.description}`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const embedDescription: string = `**${embedOptions.icons.bot} Reloaded commands**\n` + commands?.join('\n');
|
const embedDescription: string =
|
||||||
|
`**${this.embedOptions.icons.bot} Reloaded commands**\n` + commands?.join('\n');
|
||||||
|
|
||||||
logger.debug('Responding with success embed.');
|
logger.debug('Responding with success embed.');
|
||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(embedOptions.colors.success)]
|
embeds: [new EmbedBuilder().setDescription(embedDescription).setColor(this.embedOptions.colors.success)]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new ReloadCommand();
|
||||||
@@ -1,23 +1,18 @@
|
|||||||
import config from 'config';
|
|
||||||
import { EmbedBuilder, EmbedField, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, EmbedField, SlashCommandBuilder } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
|
||||||
import loggerModule from '../../../services/logger';
|
|
||||||
import { ExtendedClient } from '../../../types/clientTypes';
|
import { ExtendedClient } from '../../../types/clientTypes';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import {
|
||||||
import { BaseSlashCommandInteraction, ShardInfo } from '../../../types/interactionTypes';
|
BaseSlashCommandInteraction,
|
||||||
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType,
|
||||||
|
ShardInfo
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class ShardsCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isSystemCommand: true,
|
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('shards')
|
.setName('shards')
|
||||||
.setDescription('Show information about the running shards.')
|
.setDescription('Show information about the running shards.')
|
||||||
.setDMPermission(false)
|
|
||||||
.setNSFW(false)
|
|
||||||
.addStringOption((option) =>
|
.addStringOption((option) =>
|
||||||
option
|
option
|
||||||
.setName('sort')
|
.setName('sort')
|
||||||
@@ -33,17 +28,13 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
{ name: 'Members', value: 'members' }
|
{ name: 'Members', value: 'members' }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
.addNumberOption((option) => option.setName('page').setDescription('Page number to show').setMinValue(1));
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
|
||||||
.addNumberOption((option) => option.setName('page').setDescription('Page number to show').setMinValue(1)),
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
const { executionId, interaction, client } = params;
|
||||||
const logger: Logger = loggerModule.child({
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
source: 'shards.js',
|
|
||||||
module: 'slashCommand',
|
|
||||||
name: '/shards',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
if (await notValidGuildId({ interaction, executionId })) {
|
if (await notValidGuildId({ interaction, executionId })) {
|
||||||
return;
|
return;
|
||||||
@@ -122,9 +113,9 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
|
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.error} Oops!**\n_Hmm.._ It seems I am unable to fetch player statistics and client values from shards.`
|
`**${this.embedOptions.icons.error} Oops!**\n_Hmm.._ It seems I am unable to fetch player statistics and client values from shards.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.error)
|
.setColor(this.embedOptions.colors.error)
|
||||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
@@ -151,7 +142,8 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const evenShardIndexesString: string = evenShardIndexes.map(shardInfoToString).join('\n') + 'ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ';
|
const evenShardIndexesString: string =
|
||||||
|
evenShardIndexes.map(shardInfoToString).join('\n') + 'ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ';
|
||||||
const oddShardIndexesString: string = oddShardIndexes.map(shardInfoToString).join('\n');
|
const oddShardIndexesString: string = oddShardIndexes.map(shardInfoToString).join('\n');
|
||||||
|
|
||||||
const embedFields: EmbedField[] = [];
|
const embedFields: EmbedField[] = [];
|
||||||
@@ -183,13 +175,15 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(`**${embedOptions.icons.server} Shard overview - ${shardCount} total shards**\n`)
|
.setDescription(
|
||||||
|
`**${this.embedOptions.icons.server} Shard overview - ${shardCount} total shards**\n`
|
||||||
|
)
|
||||||
.addFields(...embedFields)
|
.addFields(...embedFields)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
.setFooter({ text: `Shard id: ${client!.shard!.ids[0]}, page ${pageIndex + 1} of ${totalPages}` })
|
.setFooter({ text: `Shard id: ${client!.shard!.ids[0]}, page ${pageIndex + 1} of ${totalPages}` })
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new ShardsCommand();
|
||||||
@@ -1,35 +1,26 @@
|
|||||||
import config from 'config';
|
|
||||||
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||||
import osu from 'node-os-utils';
|
import osu from 'node-os-utils';
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { dependencies, version } from '../../../../package.json';
|
import { dependencies, version } from '../../../../package.json';
|
||||||
import loggerModule from '../../../services/logger';
|
import {
|
||||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
BaseSlashCommandInteraction,
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
BaseSlashCommandParams,
|
||||||
|
BaseSlashCommandReturnType
|
||||||
|
} from '../../../types/interactionTypes';
|
||||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||||
import { Logger } from 'pino';
|
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
class SystemStatusCommand extends BaseSlashCommandInteraction {
|
||||||
|
constructor() {
|
||||||
const command: BaseSlashCommandInteraction = {
|
const data = new SlashCommandBuilder()
|
||||||
isSystemCommand: true,
|
|
||||||
isNew: false,
|
|
||||||
isBeta: false,
|
|
||||||
data: new SlashCommandBuilder()
|
|
||||||
.setName('systemstatus')
|
.setName('systemstatus')
|
||||||
.setDescription('Show the bot and system status.')
|
.setDescription('Show the bot and system status.');
|
||||||
.setDMPermission(false)
|
super(data);
|
||||||
.setNSFW(false),
|
}
|
||||||
execute: async ({ interaction, client, executionId }) => {
|
|
||||||
const logger: Logger = loggerModule.child({
|
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||||
source: 'systemstatus.js',
|
const { executionId, interaction, client } = params;
|
||||||
module: 'slashCommand',
|
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||||
name: '/systemstatus',
|
|
||||||
executionId: executionId,
|
|
||||||
shardId: interaction.guild?.shardId,
|
|
||||||
guildId: interaction.guild?.id
|
|
||||||
});
|
|
||||||
|
|
||||||
if (await notValidGuildId({ interaction, executionId })) {
|
if (await notValidGuildId({ interaction, executionId })) {
|
||||||
return;
|
return;
|
||||||
@@ -132,33 +123,33 @@ const command: BaseSlashCommandInteraction = {
|
|||||||
return await interaction.editReply({
|
return await interaction.editReply({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(`**${embedOptions.icons.bot} Bot status**\n` + botStatusString)
|
.setDescription(`**${this.embedOptions.icons.bot} Bot status**\n` + botStatusString)
|
||||||
.addFields(
|
.addFields(
|
||||||
{
|
{
|
||||||
name: `**${embedOptions.icons.queue} Queue status**`,
|
name: `**${this.embedOptions.icons.queue} Queue status**`,
|
||||||
value: queueStatusString,
|
value: queueStatusString,
|
||||||
inline: false
|
inline: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `**${embedOptions.icons.server} System status**`,
|
name: `**${this.embedOptions.icons.server} System status**`,
|
||||||
value: systemStatusString,
|
value: systemStatusString,
|
||||||
inline: false
|
inline: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `**${embedOptions.icons.discord} Discord status**`,
|
name: `**${this.embedOptions.icons.discord} Discord status**`,
|
||||||
value: discordStatusString,
|
value: discordStatusString,
|
||||||
inline: false
|
inline: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: `**${embedOptions.icons.bot} Dependencies**`,
|
name: `**${this.embedOptions.icons.bot} Dependencies**`,
|
||||||
value: dependenciesString,
|
value: dependenciesString,
|
||||||
inline: false
|
inline: false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.info)
|
.setColor(this.embedOptions.colors.info)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
export default command;
|
export default new SystemStatusCommand();
|
||||||
@@ -56,12 +56,12 @@ const component: BaseComponentInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.`
|
`**${this.embedOptions.icons.success} Disabled filters**\nAll audio filters have been disabled.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
],
|
],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ const component: BaseComponentInteraction = {
|
|||||||
})
|
})
|
||||||
.join('\n')}`
|
.join('\n')}`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
],
|
],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,9 +46,9 @@ const component: BaseComponentInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
|
`**${this.embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
],
|
],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
@@ -62,9 +62,9 @@ const component: BaseComponentInteraction = {
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nThis track has already been skipped or is no longer playing.`
|
`**${this.embedOptions.icons.warning} Oops!**\nThis track has already been skipped or is no longer playing.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
],
|
],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
@@ -77,7 +77,7 @@ const component: BaseComponentInteraction = {
|
|||||||
: `\`${skippedTrack.duration}\``;
|
: `\`${skippedTrack.duration}\``;
|
||||||
|
|
||||||
if (skippedTrack.raw.live) {
|
if (skippedTrack.raw.live) {
|
||||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||||
}
|
}
|
||||||
queue.node.skip();
|
queue.node.skip();
|
||||||
logger.debug('Skipped the track.');
|
logger.debug('Skipped the track.');
|
||||||
@@ -105,10 +105,10 @@ const component: BaseComponentInteraction = {
|
|||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: authorName,
|
name: authorName,
|
||||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||||
})
|
})
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${
|
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${skippedTrack.title}](${
|
||||||
skippedTrack.raw.url ?? skippedTrack.url
|
skippedTrack.raw.url ?? skippedTrack.url
|
||||||
})**` +
|
})**` +
|
||||||
`${
|
`${
|
||||||
@@ -122,7 +122,7 @@ const component: BaseComponentInteraction = {
|
|||||||
}`
|
}`
|
||||||
)
|
)
|
||||||
.setThumbnail(skippedTrack.thumbnail)
|
.setThumbnail(skippedTrack.thumbnail)
|
||||||
.setColor(embedOptions.colors.success)
|
.setColor(this.embedOptions.colors.success)
|
||||||
],
|
],
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -67,10 +67,10 @@ export class CustomError extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
abstract class BaseInteraction {
|
abstract class BaseInteraction {
|
||||||
protected getLoggerBase(module: string, source: string, executionId: string, interaction: Interaction): Logger {
|
protected getLoggerBase(module: string, name: string, executionId: string, interaction: Interaction): Logger {
|
||||||
return loggerModule.child({
|
return loggerModule.child({
|
||||||
source: source,
|
|
||||||
module: module,
|
module: module,
|
||||||
|
name: name,
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
shardId: interaction.guild?.shardId,
|
shardId: interaction.guild?.shardId,
|
||||||
guildId: interaction.guild?.id
|
guildId: interaction.guild?.id
|
||||||
@@ -107,8 +107,8 @@ export abstract class BaseSlashCommandInteraction extends BaseInteraction {
|
|||||||
this.commandName = data.name;
|
this.commandName = data.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getLogger(source: string, executionId: string, interaction: Interaction): Logger {
|
protected getLogger(name: string, executionId: string, interaction: Interaction): Logger {
|
||||||
return super.getLoggerBase('slashCommand', source, executionId, interaction);
|
return super.getLoggerBase('slashCommand', name, executionId, interaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType;
|
abstract execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType;
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ export const cannotJoinVoiceOrTalk = async ({ interaction, executionId }: Cannot
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nI do not have permission to play audio in the voice channel you are in.\n\nPlease make sure I have the **\`Connect\`** and **\`Speak\`** permissions in this voice channel.`
|
`**${this.embedOptions.icons.warning} Oops!**\nI do not have permission to play audio in the voice channel you are in.\n\nPlease make sure I have the **\`Connect\`** and **\`Speak\`** permissions in this voice channel.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -84,9 +84,9 @@ export const cannotSendMessageInChannel = async ({ interaction, executionId }: C
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nI do not have permission to send message replies in the channel you are in.\n\nPlease make sure I have the **\`View Channel\`** permission in this text channel.`
|
`**${this.embedOptions.icons.warning} Oops!**\nI do not have permission to send message replies in the channel you are in.\n\nPlease make sure I have the **\`View Channel\`** permission in this text channel.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ export const queueDoesNotExist = async ({ interaction, queue, executionId }: Que
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
|
`**${this.embedOptions.icons.warning} Oops!**\nThere are no tracks in the queue and nothing currently playing. First add some tracks with **\`/play\`**!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -56,9 +56,9 @@ export const queueNoCurrentTrack = async ({ interaction, queue, executionId }: Q
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
|
`**${this.embedOptions.icons.warning} Oops!**\nThere is nothing currently playing. First add some tracks with **\`/play\`**!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -87,9 +87,9 @@ export const queueIsEmpty = async ({ interaction, queue, executionId }: QueueIsE
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nThere are no tracks added to the queue. First add some tracks with **\`/play\`**!`
|
`**${this.embedOptions.icons.warning} Oops!**\nThere are no tracks added to the queue. First add some tracks with **\`/play\`**!`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,9 @@ export const notValidGuildId = async ({ interaction, executionId }: NotValidGuil
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command **\`/${interactionIdentifier}\`** cannot be executed in this server.`
|
`**${this.embedOptions.icons.warning} Oops!**\nNo permission to execute this command.\n\nThe command **\`/${interactionIdentifier}\`** cannot be executed in this server.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ export const notInVoiceChannel = async ({ interaction, executionId }: NotInVoice
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Not in a voice channel**\nYou need to be in a voice channel to use this command.`
|
`**${this.embedOptions.icons.warning} Not in a voice channel**\nYou need to be in a voice channel to use this command.`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -64,9 +64,9 @@ export const notInSameVoiceChannel = async ({ interaction, queue, executionId }:
|
|||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.setDescription(
|
.setDescription(
|
||||||
`**${embedOptions.icons.warning} Not in same voice channel**\nYou need to be in the same voice channel as me to use this command.\n\n**Voice channel:** ${queue.dispatcher.channel.name}`
|
`**${this.embedOptions.icons.warning} Not in same voice channel**\nYou need to be in the same voice channel as me to use this command.\n\n**Voice channel:** ${queue.dispatcher.channel.name}`
|
||||||
)
|
)
|
||||||
.setColor(embedOptions.colors.warning)
|
.setColor(this.embedOptions.colors.warning)
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user