mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-02 14:38:49 +00:00
Transcribe command descriptions and call localize
This commit is contained in:
28 files changed
+578
-181
No files matched your search
+211
-3
@@ -3,19 +3,227 @@
|
||||
"trackName": "{{title}} [Author: {{author}}]"
|
||||
},
|
||||
"commands": {
|
||||
"back": {
|
||||
"metadata": {
|
||||
"name": "back",
|
||||
"description": "Go back to previous track or specified position in history.",
|
||||
"options": {
|
||||
"position": {
|
||||
"name": "position",
|
||||
"description": "The position in history to go back to."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": {
|
||||
"metadata": {
|
||||
"name": "filters",
|
||||
"description": "Toggle various audio filters.",
|
||||
"options": {
|
||||
"type": {
|
||||
"name": "type",
|
||||
"description": "Audio filter type to use."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"guilds": {
|
||||
"metadata": {
|
||||
"name": "guilds",
|
||||
"description": "Show the top 25 guilds by member count."
|
||||
}
|
||||
},
|
||||
"help": {
|
||||
"metadata": {
|
||||
"name": "help",
|
||||
"description": "Show the list of bot commands."
|
||||
},
|
||||
"listTitle": "{{icon}} **List of commands**",
|
||||
"supportServerCallout": "{{icon}} **Support server**\nJoin the support server for help or to suggest improvements:\n{{invite}}",
|
||||
"addBotCallout": "{{icon}} **Enjoying {{botName}}?**\nAdd me to another server:\n**[Click me!]({{invite}})**"
|
||||
},
|
||||
"history": {
|
||||
"metadata": {
|
||||
"name": "history",
|
||||
"description": "Show history of tracks that have been played.",
|
||||
"options": {
|
||||
"page": {
|
||||
"name": "page",
|
||||
"description": "Page number to display for the history."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"join": {
|
||||
"metadata": {
|
||||
"name": "join",
|
||||
"description": "The bot will join the voice channel if not already in one."
|
||||
}
|
||||
},
|
||||
"leave": {
|
||||
"metadata": {
|
||||
"name": "leave",
|
||||
"description": "Clear the queue and remove bot from voice channel."
|
||||
}
|
||||
},
|
||||
"loop": {
|
||||
"metadata": {
|
||||
"name": "loop",
|
||||
"description": "Toggle looping a track, the whole queue or autoplay.",
|
||||
"options": {
|
||||
"mode": {
|
||||
"name": "mode",
|
||||
"description": "Loop mode: Track, queue, autoplay or disabled."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"lyrics": {
|
||||
"metadata": {
|
||||
"description": "Search Genius lyrics for current or specified track. TEST",
|
||||
"name": "lyrics",
|
||||
"description": "Search Genius lyrics for current or specified track.",
|
||||
"options": {
|
||||
"query": {
|
||||
"name": "query",
|
||||
"description": "Search query by text or URL. TEST"
|
||||
"description": "Search query by text or URL."
|
||||
}
|
||||
}
|
||||
},
|
||||
"autocompleteSearchResult": "{{title}} [Artist: {{artist}}]"
|
||||
},
|
||||
"help": {}
|
||||
"move": {
|
||||
"metadata": {
|
||||
"name": "move",
|
||||
"description": "Move a track to a specified position in queue.",
|
||||
"options": {
|
||||
"from": {
|
||||
"name": "from",
|
||||
"description": "The position of the track to move."
|
||||
},
|
||||
"to": {
|
||||
"name": "to",
|
||||
"description": "The position to move the track to."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"nowplaying": {
|
||||
"metadata": {
|
||||
"name": "nowplaying",
|
||||
"description": "Show information about the current track."
|
||||
}
|
||||
},
|
||||
"pause": {
|
||||
"metadata": {
|
||||
"name": "pause",
|
||||
"description": "Toggle pause for the current track."
|
||||
}
|
||||
},
|
||||
"play": {
|
||||
"metadata": {
|
||||
"name": "play",
|
||||
"description": "Add a track or playlist to the queue by search query or URL.",
|
||||
"options": {
|
||||
"query": {
|
||||
"name": "query",
|
||||
"description": "Search query by text or URL."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"queue": {
|
||||
"metadata": {
|
||||
"name": "queue",
|
||||
"description": "Show tracks that have been added to the queue.",
|
||||
"options": {
|
||||
"page": {
|
||||
"name": "page",
|
||||
"description": "Page number to display for the queue."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"reload": {
|
||||
"metadata": {
|
||||
"name": "reload",
|
||||
"description": "Reload slash command, autocomplete and component interactions across shards."
|
||||
}
|
||||
},
|
||||
"seek": {
|
||||
"metadata": {
|
||||
"name": "seek",
|
||||
"description": "Seek to a position in the current track.",
|
||||
"options": {
|
||||
"duration": {
|
||||
"name": "duration",
|
||||
"description": "Duration in format 00:00:00 (HH:mm:ss)."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shards": {
|
||||
"metadata": {
|
||||
"name": "shards",
|
||||
"description": "Show information about all connected shards.",
|
||||
"options": {
|
||||
"sort": {
|
||||
"name": "sort",
|
||||
"description": "What to sort the shards by."
|
||||
},
|
||||
"page": {
|
||||
"name": "page",
|
||||
"description": "Page number to display for the shards."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shuffle": {
|
||||
"metadata": {
|
||||
"name": "shuffle",
|
||||
"description": "Randomly shuffle all tracks in the queue."
|
||||
}
|
||||
},
|
||||
"skip": {
|
||||
"metadata": {
|
||||
"name": "skip",
|
||||
"description": "Skip track to next or specified position in queue.",
|
||||
"options": {
|
||||
"position": {
|
||||
"name": "position",
|
||||
"description": "The position in queue to skip to."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"metadata": {
|
||||
"name": "status",
|
||||
"description": "Show operational status of the bot."
|
||||
}
|
||||
},
|
||||
"stop": {
|
||||
"metadata": {
|
||||
"name": "stop",
|
||||
"description": "Clear the queue and stop playing audio."
|
||||
}
|
||||
},
|
||||
"systemstatus": {
|
||||
"metadata": {
|
||||
"name": "systemstatus",
|
||||
"description": "Show operational status of the bot with additional technical information."
|
||||
}
|
||||
},
|
||||
"volume": {
|
||||
"metadata": {
|
||||
"name": "volume",
|
||||
"description": "Show or change the playback volume for tracks.",
|
||||
"options": {
|
||||
"percentage": {
|
||||
"name": "percentage",
|
||||
"description": "Volume percentage: From 1% to 100%."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+211
-3
@@ -4,20 +4,228 @@ interface Resources {
|
||||
"trackName": "{{title}} [Author: {{author}}]"
|
||||
},
|
||||
"commands": {
|
||||
"back": {
|
||||
"metadata": {
|
||||
"name": "back",
|
||||
"description": "Go back to previous track or specified position in history.",
|
||||
"options": {
|
||||
"position": {
|
||||
"name": "position",
|
||||
"description": "The position in history to go back to."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"filters": {
|
||||
"metadata": {
|
||||
"name": "filters",
|
||||
"description": "Toggle various audio filters.",
|
||||
"options": {
|
||||
"type": {
|
||||
"name": "type",
|
||||
"description": "Audio filter type to use."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"guilds": {
|
||||
"metadata": {
|
||||
"name": "guilds",
|
||||
"description": "Show the top 25 guilds by member count."
|
||||
}
|
||||
},
|
||||
"help": {
|
||||
"metadata": {
|
||||
"name": "help",
|
||||
"description": "Show the list of bot commands."
|
||||
},
|
||||
"listTitle": "{{icon}} **List of commands**",
|
||||
"supportServerCallout": "{{icon}} **Support server**\nJoin the support server for help or to suggest improvements:\n{{invite}}",
|
||||
"addBotCallout": "{{icon}} **Enjoying {{botName}}?**\nAdd me to another server:\n**[Click me!]({{invite}})**"
|
||||
},
|
||||
"history": {
|
||||
"metadata": {
|
||||
"name": "history",
|
||||
"description": "Show history of tracks that have been played.",
|
||||
"options": {
|
||||
"page": {
|
||||
"name": "page",
|
||||
"description": "Page number to display for the history."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"join": {
|
||||
"metadata": {
|
||||
"name": "join",
|
||||
"description": "The bot will join the voice channel if not already in one."
|
||||
}
|
||||
},
|
||||
"leave": {
|
||||
"metadata": {
|
||||
"name": "leave",
|
||||
"description": "Clear the queue and remove bot from voice channel."
|
||||
}
|
||||
},
|
||||
"loop": {
|
||||
"metadata": {
|
||||
"name": "loop",
|
||||
"description": "Toggle looping a track, the whole queue or autoplay.",
|
||||
"options": {
|
||||
"mode": {
|
||||
"name": "mode",
|
||||
"description": "Loop mode: Track, queue, autoplay or disabled."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"lyrics": {
|
||||
"metadata": {
|
||||
"description": "Search Genius lyrics for current or specified track. TEST",
|
||||
"name": "lyrics",
|
||||
"description": "Search Genius lyrics for current or specified track.",
|
||||
"options": {
|
||||
"query": {
|
||||
"name": "query",
|
||||
"description": "Search query by text or URL. TEST"
|
||||
"description": "Search query by text or URL."
|
||||
}
|
||||
}
|
||||
},
|
||||
"autocompleteSearchResult": "{{title}} [Artist: {{artist}}]"
|
||||
},
|
||||
"help": {}
|
||||
"move": {
|
||||
"metadata": {
|
||||
"name": "move",
|
||||
"description": "Move a track to a specified position in queue.",
|
||||
"options": {
|
||||
"from": {
|
||||
"name": "from",
|
||||
"description": "The position of the track to move."
|
||||
},
|
||||
"to": {
|
||||
"name": "to",
|
||||
"description": "The position to move the track to."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"nowplaying": {
|
||||
"metadata": {
|
||||
"name": "nowplaying",
|
||||
"description": "Show information about the current track."
|
||||
}
|
||||
},
|
||||
"pause": {
|
||||
"metadata": {
|
||||
"name": "pause",
|
||||
"description": "Toggle pause for the current track."
|
||||
}
|
||||
},
|
||||
"play": {
|
||||
"metadata": {
|
||||
"name": "play",
|
||||
"description": "Add a track or playlist to the queue by search query or URL.",
|
||||
"options": {
|
||||
"query": {
|
||||
"name": "query",
|
||||
"description": "Search query by text or URL."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"queue": {
|
||||
"metadata": {
|
||||
"name": "queue",
|
||||
"description": "Show tracks that have been added to the queue.",
|
||||
"options": {
|
||||
"page": {
|
||||
"name": "page",
|
||||
"description": "Page number to display for the queue."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"reload": {
|
||||
"metadata": {
|
||||
"name": "reload",
|
||||
"description": "Reload slash command, autocomplete and component interactions across shards."
|
||||
}
|
||||
},
|
||||
"seek": {
|
||||
"metadata": {
|
||||
"name": "seek",
|
||||
"description": "Seek to a position in the current track.",
|
||||
"options": {
|
||||
"duration": {
|
||||
"name": "duration",
|
||||
"description": "Duration in format 00:00:00 (HH:mm:ss)."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shards": {
|
||||
"metadata": {
|
||||
"name": "shards",
|
||||
"description": "Show information about all connected shards.",
|
||||
"options": {
|
||||
"sort": {
|
||||
"name": "sort",
|
||||
"description": "What to sort the shards by."
|
||||
},
|
||||
"page": {
|
||||
"name": "page",
|
||||
"description": "Page number to display for the shards."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"shuffle": {
|
||||
"metadata": {
|
||||
"name": "shuffle",
|
||||
"description": "Randomly shuffle all tracks in the queue."
|
||||
}
|
||||
},
|
||||
"skip": {
|
||||
"metadata": {
|
||||
"name": "skip",
|
||||
"description": "Skip track to next or specified position in queue.",
|
||||
"options": {
|
||||
"position": {
|
||||
"name": "position",
|
||||
"description": "The position in queue to skip to."
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"metadata": {
|
||||
"name": "status",
|
||||
"description": "Show operational status of the bot."
|
||||
}
|
||||
},
|
||||
"stop": {
|
||||
"metadata": {
|
||||
"name": "stop",
|
||||
"description": "Clear the queue and stop playing audio."
|
||||
}
|
||||
},
|
||||
"systemstatus": {
|
||||
"metadata": {
|
||||
"name": "systemstatus",
|
||||
"description": "Show operational status of the bot with additional technical information."
|
||||
}
|
||||
},
|
||||
"volume": {
|
||||
"metadata": {
|
||||
"name": "volume",
|
||||
"description": "Show or change the playback volume for tracks.",
|
||||
"options": {
|
||||
"percentage": {
|
||||
"name": "percentage",
|
||||
"description": "Volume percentage: From 1% to 100%."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,13 @@
|
||||
"build": "tsc",
|
||||
"toc": "i18next-resources-for-ts interface -i ./locales/en -o ./locales/resources.d.ts"
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"ignore": [
|
||||
"src/**",
|
||||
"logs/**"
|
||||
],
|
||||
"execMap": {}
|
||||
},
|
||||
"dependencies": {
|
||||
"@discord-player/extractor": "^4.4.5",
|
||||
"@discord-player/opus": "^0.1.2",
|
||||
|
||||
@@ -74,7 +74,7 @@ export function localizeCommand(command: Omit<SlashCommandBuilder, 'addSubcomman
|
||||
}
|
||||
|
||||
// Localizing the command options...
|
||||
if (jsonCommand.options) {
|
||||
if (jsonCommand.options.length > 0) {
|
||||
assert(englishData.options, `Command /${command.name} must have option localizations.`);
|
||||
for (const unwritableOption of jsonCommand.options) {
|
||||
const option = unwritableOption as never as APIApplicationCommandOption;
|
||||
|
||||
@@ -7,22 +7,25 @@ import {
|
||||
} from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { localizeCommand, useServerTranslator } from '../../../common/localeUtil';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import { TFunction } from 'i18next';
|
||||
|
||||
class HelpCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder().setName('help').setDescription('Show the list of bot commands.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('help'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
async execute(params: BaseSlashCommandParams): BaseSlashCommandReturnType {
|
||||
const { executionId, client, interaction } = params;
|
||||
const logger = this.getLogger(this.name, executionId, interaction);
|
||||
const translator = useServerTranslator(interaction);
|
||||
|
||||
const [commandEmbedString, supportServerString, addBotString] = await Promise.all([
|
||||
this.getCommandEmbedString(client!),
|
||||
this.getSupportServerString(),
|
||||
this.getAddBotString()
|
||||
this.getSupportServerString(translator),
|
||||
this.getAddBotString(translator)
|
||||
]);
|
||||
|
||||
logger.debug('Responding with info embed.');
|
||||
@@ -30,7 +33,10 @@ class HelpCommand extends BaseSlashCommandInteraction {
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setDescription(
|
||||
`${this.embedOptions.icons.rule} **List of commands**\n` +
|
||||
translator('commands.help.listTitle', {
|
||||
icon: this.embedOptions.icons.rule
|
||||
}) +
|
||||
'\n' +
|
||||
commandEmbedString +
|
||||
supportServerString +
|
||||
addBotString
|
||||
@@ -77,32 +83,27 @@ class HelpCommand extends BaseSlashCommandInteraction {
|
||||
return '';
|
||||
}
|
||||
|
||||
private async getSupportServerString(): Promise<string> {
|
||||
private async getSupportServerString(translator: TFunction): Promise<string> {
|
||||
if (!this.botOptions.serverInviteUrl) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const embedString = `
|
||||
${this.embedOptions.icons.support} **Support server**
|
||||
Join the support server for help or to suggest improvements:
|
||||
**${this.botOptions.serverInviteUrl}**
|
||||
`;
|
||||
|
||||
return embedString;
|
||||
return translator('commands.help.supportServerCallout', {
|
||||
icon: this.embedOptions.icons.support,
|
||||
invite: this.botOptions.serverInviteUrl
|
||||
});
|
||||
}
|
||||
|
||||
private async getAddBotString(): Promise<string> {
|
||||
private async getAddBotString(translator: TFunction): Promise<string> {
|
||||
if (!this.botOptions.botInviteUrl) {
|
||||
return '';
|
||||
}
|
||||
|
||||
const embedString = `
|
||||
${this.embedOptions.icons.bot} **Enjoying ${this.botOptions.name}?**
|
||||
Add me to another server:
|
||||
**[Click me!](${this.botOptions.botInviteUrl})**
|
||||
`;
|
||||
|
||||
return embedString;
|
||||
return translator('commands.help.addBotCallout', {
|
||||
icon: this.embedOptions.icons.bot,
|
||||
botName: this.botOptions.name,
|
||||
invite: this.botOptions.botInviteUrl
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class StatusCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder().setName('status').setDescription('Show operational status of the bot.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('status'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,15 @@ import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../typ
|
||||
import { checkHistoryExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { Logger } from 'pino';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class BackCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('back')
|
||||
.setDescription('Go back to previous track or specified position in history.')
|
||||
.addIntegerOption((option) =>
|
||||
option.setName('position').setDescription('The position in history to go back to.').setMinValue(1)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('back')
|
||||
.addIntegerOption((option) => option.setName('position').setMinValue(1))
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import {
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||
const biquadFilterOptions: BiquadFilterOptions = config.get('biquadFilterOptions');
|
||||
@@ -33,21 +34,21 @@ const equalizerFilterOptions: EqualizerFilterOptions = config.get('equalizerFilt
|
||||
|
||||
class FiltersCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('filters')
|
||||
.setDescription('Toggle various audio filters.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('type')
|
||||
.setDescription('Audio filter type to use.')
|
||||
.setRequired(false)
|
||||
.addChoices(
|
||||
{ name: 'FFmpeg', value: 'ffmpeg' },
|
||||
{ name: 'Biquad', value: 'biquad' },
|
||||
{ name: 'Equalizer', value: 'equalizer' },
|
||||
{ name: 'Disable', value: 'disable' }
|
||||
)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('filters')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('type')
|
||||
.setRequired(false)
|
||||
.addChoices(
|
||||
{ name: 'FFmpeg', value: 'ffmpeg' },
|
||||
{ name: 'Biquad', value: 'biquad' },
|
||||
{ name: 'Equalizer', value: 'equalizer' },
|
||||
{ name: 'Disable', value: 'disable' }
|
||||
)
|
||||
)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,15 +16,15 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkHistoryExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class HistoryCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('history')
|
||||
.setDescription('Show history of tracks that have been played.')
|
||||
.addIntegerOption((option) =>
|
||||
option.setName('page').setDescription('Page number to display for the history').setMinValue(1)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('history')
|
||||
.addIntegerOption((option) => option.setName('page').setMinValue(1))
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,11 @@ import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../typ
|
||||
import { checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkVoicePermissionJoinAndTalk } from '../../../utils/validation/permissionValidator';
|
||||
import { Logger } from 'pino';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class JoinCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('join')
|
||||
.setDescription('The bot will join the voice channel if not already in one.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('join'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class LeaveCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('leave')
|
||||
.setDescription('Clear the queue and remove bot from voice channel.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('leave'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,24 +11,26 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class LoopCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('loop')
|
||||
.setDescription('Toggle looping a track, the whole queue or autoplay.')
|
||||
.addIntegerOption(() =>
|
||||
new SlashCommandIntegerOption()
|
||||
.setName('mode')
|
||||
.setDescription('Loop mode: Track, queue, autoplay or disabled.')
|
||||
.setRequired(false)
|
||||
.addChoices(
|
||||
{ name: 'Track', value: QueueRepeatMode.TRACK },
|
||||
{ name: 'Queue', value: QueueRepeatMode.QUEUE },
|
||||
{ name: 'Autoplay', value: QueueRepeatMode.AUTOPLAY },
|
||||
{ name: 'Disabled', value: QueueRepeatMode.OFF }
|
||||
)
|
||||
);
|
||||
// TODO: Add choice localization support
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('loop')
|
||||
.addIntegerOption(() =>
|
||||
new SlashCommandIntegerOption()
|
||||
.setName('mode')
|
||||
.setRequired(false)
|
||||
.addChoices(
|
||||
{ name: 'Track', value: QueueRepeatMode.TRACK },
|
||||
{ name: 'Queue', value: QueueRepeatMode.QUEUE },
|
||||
{ name: 'Autoplay', value: QueueRepeatMode.AUTOPLAY },
|
||||
{ name: 'Disabled', value: QueueRepeatMode.OFF }
|
||||
)
|
||||
)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,15 +13,8 @@ class LyricsCommand extends BaseSlashCommandInteraction {
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('lyrics')
|
||||
// .setDescription('Search Genius lyrics for current or specified track.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('query')
|
||||
// .setDescription('Search query by text or URL.')
|
||||
.setRequired(false)
|
||||
.setMinLength(2)
|
||||
.setMaxLength(500)
|
||||
.setAutocomplete(true)
|
||||
option.setName('query').setRequired(false).setMinLength(2).setMaxLength(500).setAutocomplete(true)
|
||||
)
|
||||
);
|
||||
super(data);
|
||||
|
||||
@@ -5,26 +5,16 @@ import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../typ
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { Logger } from 'pino';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class MoveCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('move')
|
||||
.setDescription('Move a track to a specified position in queue.')
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName('from')
|
||||
.setDescription('The position of the track to move')
|
||||
.setMinValue(1)
|
||||
.setRequired(true)
|
||||
)
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName('to')
|
||||
.setDescription('The position to move the track to')
|
||||
.setMinValue(1)
|
||||
.setRequired(true)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('move')
|
||||
.addIntegerOption((option) => option.setName('from').setMinValue(1).setRequired(true))
|
||||
.addIntegerOption((option) => option.setName('to').setMinValue(1).setRequired(true))
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,12 +14,11 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../../types/interactionTypes';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('nowplaying')
|
||||
.setDescription('Show information about the current track.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('nowplaying'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,10 +5,11 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class PauseCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder().setName('pause').setDescription('Toggle pause for the current track.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('pause'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,21 +6,17 @@ import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../typ
|
||||
import { checkVoicePermissionJoinAndTalk } from '../../../utils/validation/permissionValidator';
|
||||
import { transformQuery } from '../../../utils/validation/searchQueryValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class PlayCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('play')
|
||||
.setDescription('Add a track or playlist to the queue by search query or URL.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('query')
|
||||
.setDescription('Search query by text or URL')
|
||||
.setRequired(true)
|
||||
.setMinLength(2)
|
||||
.setMaxLength(500)
|
||||
.setAutocomplete(true)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('play')
|
||||
.addStringOption((option) =>
|
||||
option.setName('query').setRequired(true).setMinLength(2).setMaxLength(500).setAutocomplete(true)
|
||||
)
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,15 +17,15 @@ import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../typ
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { formatDuration } from '../../../common/formattingUtils';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class QueueCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('queue')
|
||||
.setDescription('Show tracks that have been added to the queue.')
|
||||
.addIntegerOption((option) =>
|
||||
option.setName('page').setDescription('Page number to display for the queue').setMinValue(1)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('queue')
|
||||
.addIntegerOption((option) => option.setName('page').setMinValue(1))
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import { Logger } from 'pino';
|
||||
|
||||
class RemoveCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
// TODO: Add subcommand localization support
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('remove')
|
||||
.setDescription('Remove tracks from the queue')
|
||||
|
||||
@@ -5,15 +5,15 @@ import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../typ
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { Logger } from 'pino';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class SeekCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('seek')
|
||||
.setDescription('Seek to a duration in the current track.')
|
||||
.addStringOption((option) =>
|
||||
option.setName('duration').setDescription('Duration in format 00:00:00 (HH:mm:ss).').setRequired(true)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('seek')
|
||||
.addStringOption((option) => option.setName('duration').setRequired(true))
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueEmpty, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class ShuffleCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('shuffle')
|
||||
.setDescription('Randomly shuffle all tracks in the queue.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('shuffle'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,15 +5,15 @@ import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../typ
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { Logger } from 'pino';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class SkipCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('skip')
|
||||
.setDescription('Skip track to next or specified position in queue.')
|
||||
.addIntegerOption((option) =>
|
||||
option.setName('position').setDescription('The position in queue to skip to.').setMinValue(1)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('skip')
|
||||
.addIntegerOption((option) => option.setName('position').setMinValue(1))
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class StopCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('stop')
|
||||
.setDescription('Clear the queue and stop playing audio.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('stop'));
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -5,19 +5,15 @@ import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../typ
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { Logger } from 'pino';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class VolumeCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('volume')
|
||||
.setDescription('Show or change the playback volume for tracks.')
|
||||
.addIntegerOption((option) =>
|
||||
option
|
||||
.setName('percentage')
|
||||
.setDescription('Volume percentage: From 1% to 100%.')
|
||||
.setMinValue(0)
|
||||
.setMaxValue(100)
|
||||
);
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('volume')
|
||||
.addIntegerOption((option) => option.setName('percentage').setMinValue(0).setMaxValue(100))
|
||||
);
|
||||
super(data);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class GuildsCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('guilds')
|
||||
.setDescription('Show the top 25 guilds by member count.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('guilds'));
|
||||
const isSystemCommand: boolean = true;
|
||||
super(data, isSystemCommand);
|
||||
}
|
||||
|
||||
@@ -10,12 +10,11 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class ReloadCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('reload')
|
||||
.setDescription('Reload slash command, autocomplete and component interactions across shards.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('reload'));
|
||||
const isSystemCommand: boolean = true;
|
||||
super(data, isSystemCommand);
|
||||
}
|
||||
|
||||
@@ -10,30 +10,30 @@ import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../../types/interactionTypes';
|
||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
import { Logger } from 'pino';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class ShardsCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('shards')
|
||||
.setDescription('Show information about all connected shards.')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('sort')
|
||||
.setDescription('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' }
|
||||
)
|
||||
)
|
||||
.addIntegerOption((option) =>
|
||||
option.setName('page').setDescription('Page number to display for the shards').setMinValue(1)
|
||||
);
|
||||
// TODO: Localize choices
|
||||
const data = localizeCommand(
|
||||
new SlashCommandBuilder()
|
||||
.setName('shards')
|
||||
.addStringOption((option) =>
|
||||
option
|
||||
.setName('sort')
|
||||
.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' }
|
||||
)
|
||||
)
|
||||
.addIntegerOption((option) => option.setName('page').setMinValue(1))
|
||||
);
|
||||
const isSystemCommand: boolean = true;
|
||||
super(data, isSystemCommand);
|
||||
}
|
||||
|
||||
@@ -5,12 +5,11 @@ import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { getBotStatistics, getDiscordStatus, getPlayerStatistics, getSystemStatus } from '../../../common/statusUtils';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
import { localizeCommand } from '../../../common/localeUtil';
|
||||
|
||||
class SystemStatusCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName('systemstatus')
|
||||
.setDescription('Show operational status of the bot with additional technical information.');
|
||||
const data = localizeCommand(new SlashCommandBuilder().setName('systemstatus'));
|
||||
const isSystemCommand: boolean = true;
|
||||
super(data, isSystemCommand);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user