mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-04 14:38:49 +00:00
WIP
This commit is contained in:
1 parent
d0f1e940a5
commit
6ebf7b9bd3
30 files changed
+173
-70
No files matched your search
@@ -3,7 +3,7 @@ import { Player, SearchResult, useMainPlayer } from 'discord-player';
|
|||||||
import { ApplicationCommandOptionChoiceData } from 'discord.js';
|
import { ApplicationCommandOptionChoiceData } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../services/logger';
|
||||||
import { CustomAutocompleteInteraction } from '../../types/interactionTypes';
|
import { BaseAutocompleteInteraction } from '../../types/interactionTypes';
|
||||||
|
|
||||||
const loggerTemplate: Logger = loggerModule.child({
|
const loggerTemplate: Logger = loggerModule.child({
|
||||||
source: 'lyrics.js',
|
source: 'lyrics.js',
|
||||||
@@ -14,7 +14,7 @@ const loggerTemplate: Logger = loggerModule.child({
|
|||||||
// TODO: create interface for recent query object
|
// TODO: create interface for recent query object
|
||||||
const recentQueries = new Map();
|
const recentQueries = new Map();
|
||||||
|
|
||||||
const autocomplete: CustomAutocompleteInteraction = {
|
const autocomplete: BaseAutocompleteInteraction = {
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger: Logger = loggerTemplate.child({
|
const logger: Logger = loggerTemplate.child({
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Player, SearchResult, useMainPlayer } from 'discord-player';
|
|||||||
import { ApplicationCommandOptionChoiceData } from 'discord.js';
|
import { ApplicationCommandOptionChoiceData } from 'discord.js';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../services/logger';
|
||||||
import { CustomAutocompleteInteraction } from '../../types/interactionTypes';
|
import { BaseAutocompleteInteraction } from '../../types/interactionTypes';
|
||||||
|
|
||||||
const loggerTemplate: Logger = loggerModule.child({
|
const loggerTemplate: Logger = loggerModule.child({
|
||||||
source: 'play.js',
|
source: 'play.js',
|
||||||
@@ -13,7 +13,7 @@ const loggerTemplate: Logger = loggerModule.child({
|
|||||||
// TODO: create interface for recent query object
|
// TODO: create interface for recent query object
|
||||||
const recentQueries = new Map();
|
const recentQueries = new Map();
|
||||||
|
|
||||||
const autocomplete: CustomAutocompleteInteraction = {
|
const autocomplete: BaseAutocompleteInteraction = {
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger: Logger = loggerTemplate.child({
|
const logger: Logger = loggerTemplate.child({
|
||||||
executionId: executionId,
|
executionId: executionId,
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { BotOptions, EmbedOptions } from '../../../types/configTypes';
|
import { BotOptions, EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions: BotOptions = config.get('botOptions');
|
const botOptions: BotOptions = config.get('botOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -6,12 +6,12 @@ import { Logger } from 'pino';
|
|||||||
import { version } from '../../../../package.json';
|
import { version } from '../../../../package.json';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ import {
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions, FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
|
import { EmbedOptions, FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOptio
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { BotOptions, EmbedOptions } from '../../../types/configTypes';
|
import { BotOptions, EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const botOptions: BotOptions = config.get('botOptions');
|
const botOptions: BotOptions = config.get('botOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
||||||
|
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
@@ -19,7 +19,7 @@ const loggerTemplate: Logger = loggerModule.child({
|
|||||||
name: '/lyrics'
|
name: '/lyrics'
|
||||||
});
|
});
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
|
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { CustomSlashCommandInteraction, TrackMetadata } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction, TrackMetadata } from '../../../types/interactionTypes';
|
||||||
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
@@ -21,7 +21,7 @@ import { Logger } from 'pino';
|
|||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { GuildQueue, useMainPlayer, useQueue } from 'discord-player';
|
|||||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||||
|
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { CustomError, CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { CustomError, BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { BotOptions, EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
import { BotOptions, EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
||||||
import { cannotJoinVoiceOrTalk } from '../../../utils/validation/permissionValidator';
|
import { cannotJoinVoiceOrTalk } from '../../../utils/validation/permissionValidator';
|
||||||
import { transformQuery } from '../../../utils/validation/searchQueryValidator';
|
import { transformQuery } from '../../../utils/validation/searchQueryValidator';
|
||||||
@@ -20,7 +20,7 @@ const loggerTemplate: Logger = loggerModule.child({
|
|||||||
name: '/play'
|
name: '/play'
|
||||||
});
|
});
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
import { EmbedOptions, PlayerOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueIsEmpty } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueIsEmpty } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import { SlashCommandBuilder } from 'discord.js';
|
||||||
|
import { BaseCommandInteraction, BaseSlashCommandParams } from '../../../types/interactionTypes';
|
||||||
|
|
||||||
|
export class TestCommandInteraction extends BaseCommandInteraction {
|
||||||
|
constructor() {
|
||||||
|
const data = new SlashCommandBuilder().setName('test').setDescription('Test command');
|
||||||
|
super(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
async execute(params: BaseSlashCommandParams): Promise<void> {
|
||||||
|
const { executionId, interaction } = params;
|
||||||
|
const logger = this.getLogger('test.ts', 'test', executionId, interaction);
|
||||||
|
|
||||||
|
logger.info('test command executed');
|
||||||
|
logger.info(`${interaction.user.tag} executed test command`);
|
||||||
|
logger.info(`Execution ID: ${executionId}`);
|
||||||
|
|
||||||
|
logger.info(this.embedOptions.icons.success + ' Icon success from config.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new TestCommandInteraction();
|
||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
data: new SlashCommandBuilder()
|
data: new SlashCommandBuilder()
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isSystemCommand: true,
|
isSystemCommand: true,
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import { Logger } from 'pino';
|
|||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { ExtendedClient } from '../../../types/clientTypes';
|
import { ExtendedClient } from '../../../types/clientTypes';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isSystemCommand: true,
|
isSystemCommand: true,
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import { Logger } from 'pino';
|
|||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { ExtendedClient } from '../../../types/clientTypes';
|
import { ExtendedClient } from '../../../types/clientTypes';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { CustomSlashCommandInteraction, ShardInfo } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction, ShardInfo } from '../../../types/interactionTypes';
|
||||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isSystemCommand: true,
|
isSystemCommand: true,
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import osu from 'node-os-utils';
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import { dependencies, version } from '../../../../package.json';
|
import { dependencies, version } from '../../../../package.json';
|
||||||
import loggerModule from '../../../services/logger';
|
import loggerModule from '../../../services/logger';
|
||||||
import { CustomSlashCommandInteraction } from '../../../types/interactionTypes';
|
import { BaseSlashCommandInteraction } from '../../../types/interactionTypes';
|
||||||
import { EmbedOptions } from '../../../types/configTypes';
|
import { EmbedOptions } from '../../../types/configTypes';
|
||||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||||
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
import { notValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||||
@@ -12,7 +12,7 @@ import { Logger } from 'pino';
|
|||||||
|
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const command: CustomSlashCommandInteraction = {
|
const command: BaseSlashCommandInteraction = {
|
||||||
isSystemCommand: true,
|
isSystemCommand: true,
|
||||||
isNew: false,
|
isNew: false,
|
||||||
isBeta: false,
|
isBeta: false,
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import { EmbedBuilder, GuildMember } from 'discord.js';
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../services/logger';
|
||||||
import { EmbedOptions } from '../../types/configTypes';
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
import { CustomComponentInteraction } from '../../types/interactionTypes';
|
import { BaseComponentInteraction } from '../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const component: CustomComponentInteraction = {
|
const component: BaseComponentInteraction = {
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerModule.child({
|
||||||
source: 'filters-disable-button.js',
|
source: 'filters-disable-button.js',
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember, StringSelectMenuInteraction } from 'discord.
|
|||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../services/logger';
|
||||||
import { EmbedOptions, FFmpegFilterOption, FFmpegFilterOptions } from '../../types/configTypes';
|
import { EmbedOptions, FFmpegFilterOption, FFmpegFilterOptions } from '../../types/configTypes';
|
||||||
import { CustomComponentInteraction } from '../../types/interactionTypes';
|
import { BaseComponentInteraction } from '../../types/interactionTypes';
|
||||||
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
import { queueDoesNotExist } from '../../utils/validation/queueValidator';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||||
|
|
||||||
const component: CustomComponentInteraction = {
|
const component: BaseComponentInteraction = {
|
||||||
execute: async ({ interaction, executionId }) => {
|
execute: async ({ interaction, executionId }) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerModule.child({
|
||||||
source: 'filters-select-menu.js',
|
source: 'filters-select-menu.js',
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { EmbedBuilder, GuildMember } from 'discord.js';
|
|||||||
|
|
||||||
import loggerModule from '../../services/logger';
|
import loggerModule from '../../services/logger';
|
||||||
import { EmbedOptions } from '../../types/configTypes';
|
import { EmbedOptions } from '../../types/configTypes';
|
||||||
import { CustomComponentInteraction } from '../../types/interactionTypes';
|
import { BaseComponentInteraction } from '../../types/interactionTypes';
|
||||||
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
import { notInSameVoiceChannel, notInVoiceChannel } from '../../utils/validation/voiceChannelValidator';
|
||||||
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
import { queueDoesNotExist, queueNoCurrentTrack } from '../../utils/validation/queueValidator';
|
||||||
import { Logger } from 'pino';
|
import { Logger } from 'pino';
|
||||||
const embedOptions: EmbedOptions = config.get('embedOptions');
|
const embedOptions: EmbedOptions = config.get('embedOptions');
|
||||||
|
|
||||||
const component: CustomComponentInteraction = {
|
const component: BaseComponentInteraction = {
|
||||||
execute: async ({ interaction, referenceId, executionId }) => {
|
execute: async ({ interaction, referenceId, executionId }) => {
|
||||||
const logger: Logger = loggerModule.child({
|
const logger: Logger = loggerModule.child({
|
||||||
source: 'nowplaying-skip.js',
|
source: 'nowplaying-skip.js',
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { Client, Collection, SharedNameAndDescription } from 'discord.js';
|
import { Client, Collection } from 'discord.js';
|
||||||
|
import { BaseCommandInteraction } from './interactionTypes';
|
||||||
|
|
||||||
type RegisterClientCommandsFunction = (params: { client: Client; executionId: string }) => void;
|
type RegisterClientCommandsFunction = (params: { client: Client; executionId: string }) => void;
|
||||||
|
|
||||||
|
/*
|
||||||
export interface Command {
|
export interface Command {
|
||||||
isNew?: boolean;
|
isNew?: boolean;
|
||||||
isBeta?: boolean;
|
isBeta?: boolean;
|
||||||
@@ -14,8 +16,9 @@ export interface Command {
|
|||||||
execute: (params: { interaction: object; client: ExtendedClient | undefined; executionId: string }) => void;
|
execute: (params: { interaction: object; client: ExtendedClient | undefined; executionId: string }) => void;
|
||||||
autocomplete?: (params: { interaction: object; executionId: string }) => void;
|
autocomplete?: (params: { interaction: object; executionId: string }) => void;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
export interface ExtendedClient extends Client {
|
export interface ExtendedClient extends Client {
|
||||||
registerClientCommands?: RegisterClientCommandsFunction;
|
registerClientCommands?: RegisterClientCommandsFunction;
|
||||||
commands?: Collection<string, Command>;
|
commands?: Collection<string, BaseCommandInteraction>;
|
||||||
}
|
}
|
||||||
@@ -1,49 +1,53 @@
|
|||||||
|
import config from 'config';
|
||||||
import {
|
import {
|
||||||
ApplicationCommandOptionChoiceData,
|
ApplicationCommandOptionChoiceData,
|
||||||
AutocompleteInteraction,
|
AutocompleteInteraction,
|
||||||
ChatInputCommandInteraction,
|
ChatInputCommandInteraction,
|
||||||
|
Interaction,
|
||||||
Message,
|
Message,
|
||||||
MessageComponentInteraction,
|
MessageComponentInteraction,
|
||||||
SlashCommandBuilder
|
SlashCommandBuilder
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
|
import { Logger } from 'pino';
|
||||||
|
import loggerModule from '../services/logger';
|
||||||
import { ExtendedClient } from './clientTypes';
|
import { ExtendedClient } from './clientTypes';
|
||||||
|
import { EmbedOptions } from './configTypes';
|
||||||
|
|
||||||
// Local types
|
interface BaseInteractionParams {
|
||||||
interface CommandParams {
|
|
||||||
client?: ExtendedClient;
|
|
||||||
executionId: string;
|
executionId: string;
|
||||||
interaction: ChatInputCommandInteraction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AutocompleteParams {
|
export interface BaseSlashCommandParams extends BaseInteractionParams {
|
||||||
executionId: string;
|
interaction: ChatInputCommandInteraction;
|
||||||
|
client?: ExtendedClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface BaseAutocompleteParams {
|
||||||
interaction: AutocompleteInteraction;
|
interaction: AutocompleteInteraction;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ComponentParams {
|
interface BaseComponentParams {
|
||||||
interaction: MessageComponentInteraction;
|
interaction: MessageComponentInteraction;
|
||||||
referenceId?: string;
|
referenceId?: string;
|
||||||
executionId: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Interaction types
|
// Interaction types
|
||||||
export interface CustomSlashCommandInteraction {
|
export interface BaseSlashCommandInteraction {
|
||||||
isNew: boolean;
|
isNew: boolean;
|
||||||
isBeta: boolean;
|
isBeta: boolean;
|
||||||
isSystemCommand?: boolean;
|
isSystemCommand?: boolean;
|
||||||
data: Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>;
|
data: Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>;
|
||||||
execute(params: CommandParams): Promise<Message<boolean> | void>;
|
execute(params: BaseSlashCommandParams): Promise<Message<boolean> | void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomAutocompleteInteraction {
|
export interface BaseAutocompleteInteraction {
|
||||||
execute(params: AutocompleteParams): Promise<ApplicationCommandOptionChoiceData | void>;
|
execute(params: BaseAutocompleteParams): Promise<ApplicationCommandOptionChoiceData | void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CustomComponentInteraction {
|
export interface BaseComponentInteraction {
|
||||||
execute(params: ComponentParams): Promise<Message<boolean> | void>;
|
execute(params: BaseComponentParams): Promise<Message<boolean> | void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Command specific types
|
|
||||||
export interface ShardInfo {
|
export interface ShardInfo {
|
||||||
shardId: number;
|
shardId: number;
|
||||||
memUsage: number;
|
memUsage: number;
|
||||||
@@ -66,3 +70,54 @@ export class CustomError extends Error {
|
|||||||
type?: string;
|
type?: string;
|
||||||
code?: string;
|
code?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class BaseInteraction {
|
||||||
|
protected getLoggerBase(
|
||||||
|
module: string,
|
||||||
|
source: 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
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract execute(
|
||||||
|
params: BaseInteractionParams
|
||||||
|
): Promise<Message<boolean> | ApplicationCommandOptionChoiceData | void>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export abstract class BaseCommandInteraction extends BaseInteraction {
|
||||||
|
data: Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>;
|
||||||
|
isSystemCommand: boolean;
|
||||||
|
isNew: boolean;
|
||||||
|
isBeta: boolean;
|
||||||
|
embedOptions: EmbedOptions;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
data: Omit<SlashCommandBuilder, 'addSubcommand' | 'addSubcommandGroup'>,
|
||||||
|
isSystemCommand?: boolean,
|
||||||
|
isNew?: boolean,
|
||||||
|
isBeta?: boolean
|
||||||
|
) {
|
||||||
|
super();
|
||||||
|
this.data = data;
|
||||||
|
this.isSystemCommand = isSystemCommand || false;
|
||||||
|
this.isNew = isNew || false;
|
||||||
|
this.isBeta = isBeta || false;
|
||||||
|
this.embedOptions = config.get('embedOptions');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getLogger(source: string, name: string, executionId: string, interaction: Interaction): Logger {
|
||||||
|
return super.getLoggerBase('slashCommand', source, name, executionId, interaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract execute(params: BaseSlashCommandParams): Promise<Message<boolean> | void>;
|
||||||
|
}
|
||||||
@@ -1,7 +1,13 @@
|
|||||||
import 'dotenv/config';
|
import 'dotenv/config';
|
||||||
|
|
||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { REST, RouteLike, Routes, SlashCommandBuilder } from 'discord.js';
|
import {
|
||||||
|
REST,
|
||||||
|
RESTPostAPIChatInputApplicationCommandsJSONBody,
|
||||||
|
RouteLike,
|
||||||
|
Routes,
|
||||||
|
SlashCommandBuilder
|
||||||
|
} from 'discord.js';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { v4 as uuidv4 } from 'uuid';
|
import { v4 as uuidv4 } from 'uuid';
|
||||||
@@ -23,8 +29,8 @@ const logger: Logger = loggerModule.child({
|
|||||||
|
|
||||||
//TODO: Fix deploying not working with require()
|
//TODO: Fix deploying not working with require()
|
||||||
|
|
||||||
const slashCommands: SlashCommandBuilder[] = [];
|
const slashCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
|
||||||
const systemCommands: SlashCommandBuilder[] = [];
|
const systemCommands: RESTPostAPIChatInputApplicationCommandsJSONBody[] = [];
|
||||||
const commandFolders: string[] = fs.readdirSync(path.resolve('./dist/interactions/commands'));
|
const commandFolders: string[] = fs.readdirSync(path.resolve('./dist/interactions/commands'));
|
||||||
|
|
||||||
if (!process.env.DISCORD_BOT_TOKEN) {
|
if (!process.env.DISCORD_BOT_TOKEN) {
|
||||||
@@ -45,6 +51,7 @@ const rest: REST = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_
|
|||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
for (const folder of commandFolders) {
|
for (const folder of commandFolders) {
|
||||||
const commandFiles: string[] = fs
|
const commandFiles: string[] = fs
|
||||||
.readdirSync(path.resolve(`./dist/interactions/commands/${folder}`))
|
.readdirSync(path.resolve(`./dist/interactions/commands/${folder}`))
|
||||||
@@ -59,6 +66,11 @@ const rest: REST = new REST({ version: '10' }).setToken(process.env.DISCORD_BOT_
|
|||||||
: slashCommands.push(command.data.toJSON());
|
: slashCommands.push(command.data.toJSON());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
const commandModule = await import('../interactions/commands/player/test.js');
|
||||||
|
const command = commandModule.default;
|
||||||
|
slashCommands.push(command.data.toJSON());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
logger.debug(`Bot user slash commands found: ${slashCommands.map((command) => `/${command.name}`).join(', ')}`);
|
logger.debug(`Bot user slash commands found: ${slashCommands.map((command) => `/${command.name}`).join(', ')}`);
|
||||||
|
|||||||
@@ -18,9 +18,11 @@ export const registerClientCommands = async ({ client, executionId }: RegisterCl
|
|||||||
logger.debug('Registering client commands...');
|
logger.debug('Registering client commands...');
|
||||||
client.commands = new Collection();
|
client.commands = new Collection();
|
||||||
|
|
||||||
|
/*
|
||||||
const commandFolders: string[] = fs.readdirSync(path.resolve('./dist/interactions/commands'));
|
const commandFolders: string[] = fs.readdirSync(path.resolve('./dist/interactions/commands'));
|
||||||
for (const folder of commandFolders) {
|
for (const folder of commandFolders) {
|
||||||
logger.trace(`Registering client commands for folder '${folder}'...`);
|
logger.trace(`Registering client commands for folder '${folder}'...`);
|
||||||
|
|
||||||
const commandFiles: string[] = fs
|
const commandFiles: string[] = fs
|
||||||
.readdirSync(path.resolve(`./dist/interactions/commands/${folder}`))
|
.readdirSync(path.resolve(`./dist/interactions/commands/${folder}`))
|
||||||
.filter((file) => file.endsWith('.js'));
|
.filter((file) => file.endsWith('.js'));
|
||||||
@@ -44,7 +46,15 @@ export const registerClientCommands = async ({ client, executionId }: RegisterCl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
const commandModule = await import('../interactions/commands/player/test.js');
|
||||||
|
const command = commandModule.default;
|
||||||
|
|
||||||
|
logger.info(command.data);
|
||||||
|
client.commands.set('test', command);
|
||||||
|
|
||||||
logger.trace('Registering client commands complete.');
|
logger.trace('Registering client commands complete.');
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user