mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 14:38:49 +00:00
converted commands to classes
This commit is contained in:
1 parent
335f4bb84e
commit
d81fc1d2e7
35 files changed
+618
-768
No files matched your search
@@ -35,10 +35,10 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`${embedOptions.icons.warning} **${client.user?.tag}** is **\`disconnected\`**!` +
|
||||
`${this.embedOptions.icons.warning} **${client.user?.tag}** is **\`disconnected\`**!` +
|
||||
`\n\n<@${systemOptions.systemUserId}>`
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
.setColor(this.embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`${embedOptions.icons.warning} **${client.user?.tag}** is **\`reconnecting\`**!` +
|
||||
`${this.embedOptions.icons.warning} **${client.user?.tag}** is **\`reconnecting\`**!` +
|
||||
`\n\n<@${systemOptions.systemUserId}>`
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
.setColor(this.embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
@@ -47,10 +47,10 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}>`
|
||||
)
|
||||
.setColor(embedOptions.colors.error)
|
||||
.setColor(this.embedOptions.colors.error)
|
||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||
]
|
||||
});
|
||||
|
||||
@@ -31,9 +31,9 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
@@ -47,10 +47,10 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}>`
|
||||
)
|
||||
.setColor(embedOptions.colors.error)
|
||||
.setColor(this.embedOptions.colors.error)
|
||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||
]
|
||||
});
|
||||
|
||||
@@ -32,9 +32,9 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
@@ -48,10 +48,10 @@ module.exports = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}>`
|
||||
)
|
||||
.setColor(embedOptions.colors.error)
|
||||
.setColor(this.embedOptions.colors.error)
|
||||
.setFooter({ text: `Execution ID: ${executionId}` })
|
||||
]
|
||||
});
|
||||
|
||||
@@ -27,9 +27,9 @@ export const handleError = async (
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}` })
|
||||
]
|
||||
};
|
||||
|
||||
@@ -1,33 +1,23 @@
|
||||
import config from 'config';
|
||||
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||
import osu from 'node-os-utils';
|
||||
import { Logger } from 'pino';
|
||||
// @ts-ignore
|
||||
import { version } from '../../../../package.json';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
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 = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
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
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction, client } = params;
|
||||
const logger = this.getLogger('status.js', executionId, interaction);
|
||||
|
||||
const uptimeString: string = await getUptimeFormatted({ executionId });
|
||||
const usedMemoryInMB: string = Math.ceil((await osu.mem.info()).usedMemMb).toLocaleString('en-US');
|
||||
@@ -97,28 +87,28 @@ const command: BaseSlashCommandInteraction = {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(`**${embedOptions.icons.bot} Bot status**\n` + botStatusString)
|
||||
.setDescription(`**${this.embedOptions.icons.bot} Bot status**\n` + botStatusString)
|
||||
.addFields(
|
||||
{
|
||||
name: `**${embedOptions.icons.queue} Queue status**`,
|
||||
name: `**${this.embedOptions.icons.queue} Queue status**`,
|
||||
value: queueStatusString,
|
||||
inline: false
|
||||
},
|
||||
{
|
||||
name: `**${embedOptions.icons.server} System status**`,
|
||||
name: `**${this.embedOptions.icons.server} System status**`,
|
||||
value: systemStatusString,
|
||||
inline: false
|
||||
},
|
||||
{
|
||||
name: `**${embedOptions.icons.discord} Discord status**`,
|
||||
name: `**${this.embedOptions.icons.discord} Discord status**`,
|
||||
value: discordStatusString,
|
||||
inline: false
|
||||
}
|
||||
)
|
||||
.setColor(embedOptions.colors.info)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default command;
|
||||
export default new StatusCommand();
|
||||
@@ -13,33 +13,28 @@ import {
|
||||
StringSelectMenuBuilder,
|
||||
StringSelectMenuOptionBuilder
|
||||
} from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions, FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('filters')
|
||||
.setDescription('Toggle various audio filters during playback.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'filters.js',
|
||||
module: 'slashCommand',
|
||||
name: '/filters',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('filters')
|
||||
.setDescription('Toggle various audio filters during playback.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -92,7 +87,7 @@ const command: BaseSlashCommandInteraction = {
|
||||
.setCustomId('filters-disable-button')
|
||||
.setLabel('Disable all filters')
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
.setEmoji(embedOptions.icons.disable)
|
||||
.setEmoji(this.embedOptions.icons.disable)
|
||||
.toJSON();
|
||||
|
||||
const disableFiltersActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||
@@ -105,11 +100,11 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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]
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default command;
|
||||
export default new FiltersCommand();
|
||||
@@ -1,32 +1,24 @@
|
||||
import config from 'config';
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class LeaveCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('leave')
|
||||
.setDescription('Clear the track queue and remove the bot from voice channel.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('leave')
|
||||
.setDescription('Clear the track queue and remove the bot from voice channel.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'leave.js',
|
||||
module: 'slashCommand',
|
||||
name: '/leave',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -61,15 +53,15 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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,45 +1,36 @@
|
||||
import config from 'config';
|
||||
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { BotOptions, EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
const botOptions: BotOptions = config.get('botOptions');
|
||||
class LoopCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('loop')
|
||||
.setDescription('Toggle looping a track, the whole queue or autoplay.')
|
||||
.addStringOption(() =>
|
||||
new SlashCommandStringOption()
|
||||
.setName('mode')
|
||||
.setDescription('Mode to set for looping.')
|
||||
.setRequired(false)
|
||||
.addChoices(
|
||||
{ name: 'Track', value: '1' },
|
||||
{ name: 'Queue', value: '2' },
|
||||
{ name: 'Autoplay', value: '3' },
|
||||
{ name: 'Disabled', value: '0' }
|
||||
)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('loop')
|
||||
.setDescription('Toggle looping a track, the whole queue or autoplay.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addStringOption(() =>
|
||||
new SlashCommandStringOption()
|
||||
.setName('mode')
|
||||
.setDescription('Mode to set for looping.')
|
||||
.setRequired(false)
|
||||
.addChoices(
|
||||
{ name: 'Track', value: '1' },
|
||||
{ name: 'Queue', value: '2' },
|
||||
{ name: 'Autoplay', value: '3' },
|
||||
{ name: 'Disabled', value: '0' }
|
||||
)
|
||||
),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'loop.js',
|
||||
module: 'slashCommand',
|
||||
name: '/loop',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -77,10 +68,10 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.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}\`**.`
|
||||
)
|
||||
.setColor(embedOptions.colors.info)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -93,9 +84,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
@@ -140,12 +131,12 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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,47 +1,34 @@
|
||||
import config from 'config';
|
||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
||||
import { GuildQueue, Player, QueryType, useMainPlayer, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
|
||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
||||
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { Logger } from 'pino';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class LyricsCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('lyrics')
|
||||
.setDescription('Get lyrics from Genius for current or specified track.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('query')
|
||||
.setDescription('Search query or URL.')
|
||||
.setRequired(false)
|
||||
.setMinLength(2)
|
||||
.setMaxLength(500)
|
||||
.setAutocomplete(true)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
const loggerTemplate: Logger = loggerModule.child({
|
||||
source: 'lyrics.js',
|
||||
module: 'slashCommand',
|
||||
name: '/lyrics'
|
||||
});
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('lyrics')
|
||||
.setDescription('Get lyrics from Genius for current or specified track.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('query')
|
||||
.setDescription('Search query or URL.')
|
||||
.setRequired(false)
|
||||
.setMinLength(2)
|
||||
.setMaxLength(500)
|
||||
.setAutocomplete(true)
|
||||
),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerTemplate.child({
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const query: string = interaction.options.getString('query')!;
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
@@ -84,9 +71,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.queue} Showing lyrics**\n` +
|
||||
`**${this.embedOptions.icons.queue} Showing lyrics**\n` +
|
||||
`**Track: [${lyricsResult.title}](${lyricsResult.url})**\n` +
|
||||
`**Artist: [${lyricsResult.artist.name}](${lyricsResult.artist.url})**` +
|
||||
`\n\n\`\`\`fix\n${message}\`\`\``
|
||||
)
|
||||
.setColor(embedOptions.colors.info)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
]
|
||||
});
|
||||
continue;
|
||||
@@ -181,7 +168,7 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(`\`\`\`fix\n${message}\`\`\``)
|
||||
.setColor(embedOptions.colors.info)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -195,15 +182,15 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.queue} Showing lyrics**\n` +
|
||||
`**${this.embedOptions.icons.queue} Showing lyrics**\n` +
|
||||
`**Track: [${lyricsResult.title}](${lyricsResult.url})**\n` +
|
||||
`**Artist: [${lyricsResult.artist.name}](${lyricsResult.artist.url})**` +
|
||||
`\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,
|
||||
SlashCommandBuilder
|
||||
} from 'discord.js';
|
||||
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { BaseSlashCommandInteraction, TrackMetadata } from '../../../types/interactionTypes';
|
||||
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
||||
import { PlayerOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType,
|
||||
TrackMetadata
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { Logger } from 'pino';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('nowplaying')
|
||||
.setDescription('Show information about the track currently playing.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'nowplaying.js',
|
||||
module: 'slashCommand',
|
||||
name: '/nowplaying',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('nowplaying')
|
||||
.setDescription('Show information about the track currently playing.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -64,11 +59,11 @@ const command: BaseSlashCommandInteraction = {
|
||||
]);
|
||||
|
||||
const sourceIcons: Map<string, string> = new Map([
|
||||
['youtube', embedOptions.icons.sourceYouTube],
|
||||
['soundcloud', embedOptions.icons.sourceSoundCloud],
|
||||
['spotify', embedOptions.icons.sourceSpotify],
|
||||
['apple_music', embedOptions.icons.sourceAppleMusic],
|
||||
['arbitrary', embedOptions.icons.sourceArbitrary]
|
||||
['youtube', this.embedOptions.icons.sourceYouTube],
|
||||
['soundcloud', this.embedOptions.icons.sourceSoundCloud],
|
||||
['spotify', this.embedOptions.icons.sourceSpotify],
|
||||
['apple_music', this.embedOptions.icons.sourceAppleMusic],
|
||||
['arbitrary', this.embedOptions.icons.sourceArbitrary]
|
||||
]);
|
||||
|
||||
const currentTrack: Track = queue.currentTrack!;
|
||||
@@ -106,7 +101,7 @@ const command: BaseSlashCommandInteraction = {
|
||||
}
|
||||
|
||||
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}`;
|
||||
@@ -116,7 +111,7 @@ const command: BaseSlashCommandInteraction = {
|
||||
.setCustomId(customId)
|
||||
.setLabel('Skip track')
|
||||
.setStyle(ButtonStyle.Secondary)
|
||||
.setEmoji(embedOptions.icons.nextTrack)
|
||||
.setEmoji(this.embedOptions.icons.nextTrack)
|
||||
.toJSON();
|
||||
|
||||
const nowPlayingActionRow: APIActionRowComponent<APIMessageActionRowComponent> = {
|
||||
@@ -141,12 +136,12 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
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(
|
||||
(queue.node.isPaused()
|
||||
? '**Currently Paused**\n'
|
||||
: `**${embedOptions.icons.audioPlaying} Now Playing**\n`) +
|
||||
: `**${this.embedOptions.icons.audioPlaying} Now Playing**\n`) +
|
||||
`**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**` +
|
||||
`\nRequested by: <@${currentTrack.requestedBy?.id}>` +
|
||||
`\n ${bar}\n\n` +
|
||||
@@ -154,7 +149,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
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\`**.`
|
||||
}`
|
||||
)
|
||||
@@ -181,11 +178,11 @@ const command: BaseSlashCommandInteraction = {
|
||||
text: queueLength ? `${queueLength} other tracks in the queue...` : ' '
|
||||
})
|
||||
.setThumbnail(queue.currentTrack!.thumbnail)
|
||||
.setColor(embedOptions.colors.info)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
],
|
||||
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 { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
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 = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
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
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -51,7 +42,7 @@ const command: BaseSlashCommandInteraction = {
|
||||
: `\`${currentTrack.duration}\``;
|
||||
|
||||
if (currentTrack.raw.live) {
|
||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
}
|
||||
|
||||
// change paused state to opposite of current state
|
||||
@@ -72,18 +63,18 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.pauseResumed} ${
|
||||
`**${this.embedOptions.icons.pauseResumed} ${
|
||||
queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
|
||||
}**\n**${durationFormat} [${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**`
|
||||
)
|
||||
.setThumbnail(currentTrack.thumbnail)
|
||||
.setColor(embedOptions.colors.success)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default command;
|
||||
export default new PauseCommand();
|
||||
@@ -1,48 +1,39 @@
|
||||
import config from 'config';
|
||||
import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { CustomError, BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import { BotOptions, EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
||||
import { PlayerOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType,
|
||||
CustomError
|
||||
} from '../../../types/interactionTypes';
|
||||
import { cannotJoinVoiceOrTalk } from '../../../utils/validation/permissionValidator';
|
||||
import { transformQuery } from '../../../utils/validation/searchQueryValidator';
|
||||
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 loggerTemplate: Logger = loggerModule.child({
|
||||
source: 'play.js',
|
||||
module: 'slashCommand',
|
||||
name: '/play'
|
||||
});
|
||||
class PlayCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('play')
|
||||
.setDescription('Add a track or playlist to the queue by searching or url.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('query')
|
||||
.setDescription('Search query or URL.')
|
||||
.setRequired(true)
|
||||
.setMinLength(2)
|
||||
.setMaxLength(500)
|
||||
.setAutocomplete(true)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('play')
|
||||
.setDescription('Add a track or playlist to the queue by searching or url.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('query')
|
||||
.setDescription('Search query or URL.')
|
||||
.setRequired(true)
|
||||
.setMinLength(2)
|
||||
.setMaxLength(500)
|
||||
.setAutocomplete(true)
|
||||
),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger = loggerTemplate.child({
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
let queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
if (queue && (await notInSameVoiceChannel({ interaction, queue, executionId }))) {
|
||||
@@ -83,9 +74,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
@@ -199,9 +190,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
@@ -225,9 +216,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
@@ -243,14 +234,14 @@ const command: BaseSlashCommandInteraction = {
|
||||
logger.debug(
|
||||
`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 =
|
||||
Number(track.raw.duration) === 0 || track.duration === '0:00' ? '' : `\`${track.duration}\``;
|
||||
|
||||
if (track.raw.live) {
|
||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
}
|
||||
|
||||
if (searchResult.playlist && searchResult.tracks.length > 1) {
|
||||
@@ -270,17 +261,17 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
|
||||
`**${this.embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
|
||||
track.title
|
||||
}](${track.raw.url ?? track.url})**\n\nAnd **${
|
||||
searchResult.tracks.length - 1
|
||||
}** more tracks... **\`/queue\`** to view all.`
|
||||
)
|
||||
.setThumbnail(track.thumbnail)
|
||||
.setColor(embedOptions.colors.success)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -302,15 +293,15 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.audioStartedPlaying} Started playing**\n**${durationFormat} [${
|
||||
`**${this.embedOptions.icons.audioStartedPlaying} Started playing**\n**${durationFormat} [${
|
||||
track.title
|
||||
}](${track.raw.url ?? track.url})**`
|
||||
)
|
||||
.setThumbnail(track.thumbnail)
|
||||
.setColor(embedOptions.colors.success)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -331,18 +322,18 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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
|
||||
})**`
|
||||
)
|
||||
.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 { GuildQueue, PlayerTimestamp, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
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 { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('queue')
|
||||
.setDescription('Show the list of tracks added to the queue.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addNumberOption((option) => option.setName('page').setDescription('Page number of the queue').setMinValue(1)),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'queue.js',
|
||||
module: 'slashCommand',
|
||||
name: '/queue',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
class QueueCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('queue')
|
||||
.setDescription('Show the list of tracks added to the queue.')
|
||||
.addNumberOption((option) =>
|
||||
option.setName('page').setDescription('Page number of the queue').setMinValue(1)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -58,11 +56,11 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.warning} Oops!**\nPage **\`${
|
||||
`**${this.embedOptions.icons.warning} Oops!**\nPage **\`${
|
||||
pageIndex + 1
|
||||
}\`** 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}\``;
|
||||
|
||||
if (track.raw.live) {
|
||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
}
|
||||
|
||||
return `**${pageIndex * 10 + index + 1}.** **${durationFormat} [${track.title}](${
|
||||
@@ -116,15 +114,16 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
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(
|
||||
`${repeatModeString}` + `**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
||||
`${repeatModeString}` +
|
||||
`**${this.embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
||||
)
|
||||
.setFooter({
|
||||
text: `Page ${pageIndex + 1} of ${totalPages} (${queueLength} tracks)`
|
||||
})
|
||||
.setColor(embedOptions.colors.info)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
]
|
||||
});
|
||||
} else {
|
||||
@@ -144,7 +143,7 @@ const command: BaseSlashCommandInteraction = {
|
||||
}
|
||||
|
||||
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.');
|
||||
@@ -153,27 +152,27 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
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(
|
||||
`**${embedOptions.icons.audioPlaying} Now playing**\n` +
|
||||
`**${this.embedOptions.icons.audioPlaying} Now playing**\n` +
|
||||
(currentTrack
|
||||
? `**[${currentTrack.title}](${currentTrack.raw.url ?? currentTrack.url})**`
|
||||
: 'None') +
|
||||
`\nRequested by: <@${currentTrack.requestedBy?.id}>` +
|
||||
`\n ${bar}\n\n` +
|
||||
`${repeatModeString}` +
|
||||
`**${embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
||||
`**${this.embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
||||
)
|
||||
.setThumbnail(currentTrack.thumbnail)
|
||||
.setFooter({
|
||||
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 { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class RemoveCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('remove')
|
||||
.setDescription('Remove a specific track from the queue')
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName('tracknumber')
|
||||
.setDescription('Track number to remove from queue.')
|
||||
.setMinValue(1)
|
||||
.setRequired(true)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('remove')
|
||||
.setDescription('Remove a specific track from the queue.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName('tracknumber')
|
||||
.setDescription('Track number to remove from queue.')
|
||||
.setMinValue(1)
|
||||
.setRequired(true)
|
||||
),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'remove.js',
|
||||
module: 'slashCommand',
|
||||
name: '/remove',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -59,9 +51,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}\``;
|
||||
|
||||
if (removedTrack.raw.live) {
|
||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
}
|
||||
|
||||
let authorName: string;
|
||||
@@ -92,18 +84,18 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.success} Removed track**\n**${durationFormat} [${removedTrack.title}](${
|
||||
removedTrack.raw.url ?? removedTrack.url
|
||||
})**`
|
||||
`**${this.embedOptions.icons.success} Removed track**\n**${durationFormat} [${
|
||||
removedTrack.title
|
||||
}](${removedTrack.raw.url ?? removedTrack.url})**`
|
||||
)
|
||||
.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 { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class SeekCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('seek')
|
||||
.setDescription('Seek to a specified duration in the current track.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('duration')
|
||||
.setDescription('Duration in format 00:00:00 (HH:mm:ss) to seek to.')
|
||||
.setRequired(true)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('seek')
|
||||
.setDescription('Seek to a specified duration in the current track.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('duration')
|
||||
.setDescription('Duration in format 00:00:00 (HH:mm:ss) to seek to.')
|
||||
.setRequired(true)
|
||||
),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'seek.js',
|
||||
module: 'slashCommand',
|
||||
name: '/seek',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -78,12 +70,12 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
||||
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
.setColor(this.embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -100,12 +92,12 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
||||
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
.setColor(this.embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -123,12 +115,12 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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`** **`3:27`** - Seek to 3 minutes and 27 seconds.\n' +
|
||||
'- **`/seek`** **`42`** - Seek to 42 seconds.'
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
.setColor(this.embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -146,12 +138,12 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.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 (**\`${
|
||||
queue.currentTrack!.duration
|
||||
}\`**).`
|
||||
)
|
||||
.setColor(embedOptions.colors.warning)
|
||||
.setColor(this.embedOptions.colors.warning)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -173,16 +165,16 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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)
|
||||
.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 { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist, queueIsEmpty } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class ShuffleCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('shuffle')
|
||||
.setDescription('Shuffle tracks in the queue randomly.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('shuffle')
|
||||
.setDescription('Shuffle tracks in the queue randomly.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'shuffle.js',
|
||||
module: 'slashCommand',
|
||||
name: '/shuffle',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -60,15 +52,15 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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 { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class SkipCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('test')
|
||||
.setDescription('Skip current or specified track.')
|
||||
.addNumberOption((option) =>
|
||||
option.setName('tracknumber').setDescription('Track number to skip to in the queue.').setMinValue(1)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('skip')
|
||||
.setDescription('Skip current or specified track.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addNumberOption((option) =>
|
||||
option.setName('tracknumber').setDescription('Track number to skip to in the queue.').setMinValue(1)
|
||||
),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'skip.js',
|
||||
module: 'slashCommand',
|
||||
name: '/skip',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -57,9 +49,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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 {
|
||||
@@ -72,7 +64,7 @@ const command: BaseSlashCommandInteraction = {
|
||||
: `\`${skippedTrack.duration}\``;
|
||||
|
||||
if (skippedTrack.raw.live) {
|
||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
}
|
||||
|
||||
queue.node.skipTo(skipToTrack - 1);
|
||||
@@ -92,15 +84,15 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||
skippedTrack.title
|
||||
}](${skippedTrack.raw.url ?? skippedTrack.url})**`
|
||||
)
|
||||
.setThumbnail(skippedTrack.thumbnail)
|
||||
.setColor(embedOptions.colors.success)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
]
|
||||
});
|
||||
}
|
||||
@@ -113,9 +105,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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}\``;
|
||||
|
||||
if (skippedTrack.raw.live) {
|
||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
}
|
||||
queue.node.skip();
|
||||
logger.debug('Skipped current track.');
|
||||
@@ -156,10 +148,10 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setDescription(
|
||||
`**${embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||
skippedTrack.title
|
||||
}](${skippedTrack.raw.url ?? skippedTrack.url})**` +
|
||||
`${
|
||||
@@ -167,17 +159,17 @@ const command: BaseSlashCommandInteraction = {
|
||||
? ''
|
||||
: `\n\n**${
|
||||
queue.repeatMode === 3
|
||||
? embedOptions.icons.autoplaying
|
||||
: embedOptions.icons.looping
|
||||
? this.embedOptions.icons.autoplaying
|
||||
: this.embedOptions.icons.looping
|
||||
} Looping**\nLoop mode is set to **\`${loopModeUserString}\`**. You can change it with **\`/loop\`**.`
|
||||
}`
|
||||
)
|
||||
.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 { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class StopCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('stop')
|
||||
.setDescription('Stop playing audio and clear the track queue.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('stop')
|
||||
.setDescription('Stop playing audio and clear the track queue.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'stop.js',
|
||||
module: 'slashCommand',
|
||||
name: '/stop',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -63,15 +55,15 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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 {
|
||||
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.');
|
||||
return await interaction.editReply({
|
||||
embeds: [new EmbedBuilder().setDescription(`Success reply from command '${this.commandName}'.`).setColor(this.embedOptions.colors.success)]
|
||||
});
|
||||
// logic
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +1,31 @@
|
||||
import config from 'config';
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class VolumeCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('volume')
|
||||
.setDescription('Show or set the playback volume for tracks.')
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName('percentage')
|
||||
.setDescription('Set volume percentage from 1% to 100%.')
|
||||
.setMinValue(0)
|
||||
.setMaxValue(100)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('volume')
|
||||
.setDescription('Show or set the playback volume for tracks.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addNumberOption((option) =>
|
||||
option
|
||||
.setName('percentage')
|
||||
.setDescription('Set volume percentage from 1% to 100%.')
|
||||
.setMinValue(0)
|
||||
.setMaxValue(100)
|
||||
),
|
||||
execute: async ({ interaction, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'volume.js',
|
||||
module: 'slashCommand',
|
||||
name: '/volume',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
const queue: GuildQueue = useQueue(interaction.guild!.id)!;
|
||||
|
||||
@@ -62,10 +54,12 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.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}%\`**.`
|
||||
)
|
||||
.setColor(embedOptions.colors.info)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
]
|
||||
});
|
||||
} else if (volume > 100 || volume < 0) {
|
||||
@@ -76,9 +70,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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 {
|
||||
@@ -100,12 +94,12 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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 { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class GuildsCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('guilds')
|
||||
.setDescription('Show list of guilds where bot is added.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isSystemCommand: true,
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('guilds')
|
||||
.setDescription('Show list of guilds where bot is added.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false),
|
||||
execute: async ({ interaction, client, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'guilds.js',
|
||||
module: 'slashCommand',
|
||||
name: '/guilds',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction, client } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
if (await notValidGuildId({ interaction, executionId })) {
|
||||
return;
|
||||
@@ -35,8 +26,8 @@ const command: BaseSlashCommandInteraction = {
|
||||
let totalGuildCount: number = 0;
|
||||
|
||||
logger.debug('Fetching guilds from all shards.');
|
||||
await client!.shard!
|
||||
.broadcastEval((c) => {
|
||||
await client!
|
||||
.shard!.broadcastEval((c) => {
|
||||
return c.guilds.cache.map((guild) => {
|
||||
return guild;
|
||||
});
|
||||
@@ -64,7 +55,7 @@ const command: BaseSlashCommandInteraction = {
|
||||
const totalMemberCount: number = shardGuilds.reduce((a, b) => a + b.memberCount, 0);
|
||||
|
||||
let embedDescription =
|
||||
`**${embedOptions.icons.bot} ${
|
||||
`**${this.embedOptions.icons.bot} ${
|
||||
totalGuildCount < 25 ? `Top ${totalGuildCount} guilds` : 'Top 25 guilds'
|
||||
} by member count (${totalGuildCount} total)**\n${guildListFormatted}` +
|
||||
`\n\n**Total members:** **\`${totalMemberCount}\`**`;
|
||||
@@ -78,9 +69,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
|
||||
logger.debug('Responding with info embed.');
|
||||
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 { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
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 = {
|
||||
isSystemCommand: true,
|
||||
isNew: false,
|
||||
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
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction, client } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
if (await notValidGuildId({ interaction, executionId })) {
|
||||
return;
|
||||
@@ -53,9 +42,9 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
@@ -66,13 +55,14 @@ const command: BaseSlashCommandInteraction = {
|
||||
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.');
|
||||
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,49 +1,40 @@
|
||||
import config from 'config';
|
||||
import { EmbedBuilder, EmbedField, SlashCommandBuilder } from 'discord.js';
|
||||
import { Logger } from 'pino';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandInteraction, ShardInfo } from '../../../types/interactionTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType,
|
||||
ShardInfo
|
||||
} from '../../../types/interactionTypes';
|
||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class ShardsCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('shards')
|
||||
.setDescription('Show information about the running shards.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('sort')
|
||||
.setDescription('If specified, what to sort the shards by.')
|
||||
.setRequired(false)
|
||||
.addChoices(
|
||||
{ name: 'None (Shard ID)', value: 'none' },
|
||||
{ name: 'Memory usage', value: 'memory' },
|
||||
{ name: 'Voice Connections', value: 'connections' },
|
||||
{ name: 'Tracks', value: 'tracks' },
|
||||
{ name: 'Listeners', value: 'listeners' },
|
||||
{ name: 'Guilds', value: 'guilds' },
|
||||
{ name: 'Members', value: 'members' }
|
||||
)
|
||||
)
|
||||
.addNumberOption((option) => option.setName('page').setDescription('Page number to show').setMinValue(1));
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isSystemCommand: true,
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('shards')
|
||||
.setDescription('Show information about the running shards.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false)
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('sort')
|
||||
.setDescription('If specified, what to sort the shards by.')
|
||||
.setRequired(false)
|
||||
.addChoices(
|
||||
{ name: 'None (Shard ID)', value: 'none' },
|
||||
{ name: 'Memory usage', value: 'memory' },
|
||||
{ name: 'Voice Connections', value: 'connections' },
|
||||
{ name: 'Tracks', value: 'tracks' },
|
||||
{ name: 'Listeners', value: 'listeners' },
|
||||
{ name: 'Guilds', value: 'guilds' },
|
||||
{ name: 'Members', value: 'members' }
|
||||
)
|
||||
)
|
||||
|
||||
.addNumberOption((option) => option.setName('page').setDescription('Page number to show').setMinValue(1)),
|
||||
execute: async ({ interaction, client, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'shards.js',
|
||||
module: 'slashCommand',
|
||||
name: '/shards',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction, client } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
if (await notValidGuildId({ interaction, executionId })) {
|
||||
return;
|
||||
@@ -122,17 +113,17 @@ const command: BaseSlashCommandInteraction = {
|
||||
new EmbedBuilder()
|
||||
|
||||
.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}` })
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
const shardCount: number = shardInfoList.length;
|
||||
const totalPages:number = Math.ceil(shardCount / 10) || 1;
|
||||
const pageIndex:number = (interaction.options.getNumber('page') || 1) - 1;
|
||||
const totalPages: number = Math.ceil(shardCount / 10) || 1;
|
||||
const pageIndex: number = (interaction.options.getNumber('page') || 1) - 1;
|
||||
|
||||
const currentPageShards: ShardInfo[] = shardInfoList.slice(pageIndex * 10, pageIndex * 10 + 10);
|
||||
|
||||
@@ -151,7 +142,8 @@ const command: BaseSlashCommandInteraction = {
|
||||
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 embedFields: EmbedField[] = [];
|
||||
@@ -183,13 +175,15 @@ const command: BaseSlashCommandInteraction = {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
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)
|
||||
.setColor(embedOptions.colors.info)
|
||||
.setColor(this.embedOptions.colors.info)
|
||||
.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 osu from 'node-os-utils';
|
||||
// @ts-ignore
|
||||
import { dependencies, version } from '../../../../package.json';
|
||||
import loggerModule from '../../../services/logger';
|
||||
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||
import { EmbedOptions } from '../../../types/configTypes';
|
||||
import {
|
||||
BaseSlashCommandInteraction,
|
||||
BaseSlashCommandParams,
|
||||
BaseSlashCommandReturnType
|
||||
} from '../../../types/interactionTypes';
|
||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
import { Logger } from 'pino';
|
||||
|
||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||
class SystemStatusCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('systemstatus')
|
||||
.setDescription('Show the bot and system status.');
|
||||
super(data);
|
||||
}
|
||||
|
||||
const command: BaseSlashCommandInteraction = {
|
||||
isSystemCommand: true,
|
||||
isNew: false,
|
||||
isBeta: false,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('systemstatus')
|
||||
.setDescription('Show the bot and system status.')
|
||||
.setDMPermission(false)
|
||||
.setNSFW(false),
|
||||
execute: async ({ interaction, client, executionId }) => {
|
||||
const logger: Logger = loggerModule.child({
|
||||
source: 'systemstatus.js',
|
||||
module: 'slashCommand',
|
||||
name: '/systemstatus',
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
});
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, interaction, client } = params;
|
||||
const logger = this.getLogger(this.commandName, executionId, interaction);
|
||||
|
||||
if (await notValidGuildId({ interaction, executionId })) {
|
||||
return;
|
||||
@@ -132,33 +123,33 @@ const command: BaseSlashCommandInteraction = {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(`**${embedOptions.icons.bot} Bot status**\n` + botStatusString)
|
||||
.setDescription(`**${this.embedOptions.icons.bot} Bot status**\n` + botStatusString)
|
||||
.addFields(
|
||||
{
|
||||
name: `**${embedOptions.icons.queue} Queue status**`,
|
||||
name: `**${this.embedOptions.icons.queue} Queue status**`,
|
||||
value: queueStatusString,
|
||||
inline: false
|
||||
},
|
||||
{
|
||||
name: `**${embedOptions.icons.server} System status**`,
|
||||
name: `**${this.embedOptions.icons.server} System status**`,
|
||||
value: systemStatusString,
|
||||
inline: false
|
||||
},
|
||||
{
|
||||
name: `**${embedOptions.icons.discord} Discord status**`,
|
||||
name: `**${this.embedOptions.icons.discord} Discord status**`,
|
||||
value: discordStatusString,
|
||||
inline: false
|
||||
},
|
||||
{
|
||||
name: `**${embedOptions.icons.bot} Dependencies**`,
|
||||
name: `**${this.embedOptions.icons.bot} Dependencies**`,
|
||||
value: dependenciesString,
|
||||
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()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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: []
|
||||
});
|
||||
|
||||
@@ -103,7 +103,7 @@ const component: BaseComponentInteraction = {
|
||||
})
|
||||
.join('\n')}`
|
||||
)
|
||||
.setColor(embedOptions.colors.success)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
],
|
||||
components: []
|
||||
});
|
||||
|
||||
@@ -46,9 +46,9 @@ const component: BaseComponentInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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: []
|
||||
});
|
||||
@@ -62,9 +62,9 @@ const component: BaseComponentInteraction = {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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: []
|
||||
});
|
||||
@@ -77,7 +77,7 @@ const component: BaseComponentInteraction = {
|
||||
: `\`${skippedTrack.duration}\``;
|
||||
|
||||
if (skippedTrack.raw.live) {
|
||||
durationFormat = `${embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
}
|
||||
queue.node.skip();
|
||||
logger.debug('Skipped the track.');
|
||||
@@ -105,10 +105,10 @@ const component: BaseComponentInteraction = {
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || embedOptions.info.fallbackIconUrl
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.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
|
||||
})**` +
|
||||
`${
|
||||
@@ -122,7 +122,7 @@ const component: BaseComponentInteraction = {
|
||||
}`
|
||||
)
|
||||
.setThumbnail(skippedTrack.thumbnail)
|
||||
.setColor(embedOptions.colors.success)
|
||||
.setColor(this.embedOptions.colors.success)
|
||||
],
|
||||
components: []
|
||||
});
|
||||
|
||||
@@ -67,10 +67,10 @@ export class CustomError extends Error {
|
||||
}
|
||||
|
||||
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({
|
||||
source: source,
|
||||
module: module,
|
||||
name: name,
|
||||
executionId: executionId,
|
||||
shardId: interaction.guild?.shardId,
|
||||
guildId: interaction.guild?.id
|
||||
@@ -107,8 +107,8 @@ export abstract class BaseSlashCommandInteraction extends BaseInteraction {
|
||||
this.commandName = data.name;
|
||||
}
|
||||
|
||||
protected getLogger(source: string, executionId: string, interaction: Interaction): Logger {
|
||||
return super.getLoggerBase('slashCommand', source, executionId, interaction);
|
||||
protected getLogger(name: string, executionId: string, interaction: Interaction): Logger {
|
||||
return super.getLoggerBase('slashCommand', name, executionId, interaction);
|
||||
}
|
||||
|
||||
abstract execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType;
|
||||
|
||||
@@ -35,9 +35,9 @@ export const cannotJoinVoiceOrTalk = async ({ interaction, executionId }: Cannot
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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: [
|
||||
new EmbedBuilder()
|
||||
.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