mirror of
https://github.com/darksaid98/cadence-discord-bot.git
synced 2026-12-03 06:28:53 +00:00
fix: Extract logic for getting author value for embeds
This commit is contained in:
1 parent
8c05499f08
commit
83e23d87b4
60 files changed
+126
-317
No files matched your search
@@ -1,6 +1,6 @@
|
||||
import { EmbedBuilder, SlashCommandBuilder, SlashCommandNumberOption, SlashCommandStringOption } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
|
||||
class HelpCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||
import osu from 'node-os-utils';
|
||||
// @ts-ignore
|
||||
import { version } from '../../../../package.json';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||
|
||||
class StatusCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
@@ -18,8 +18,8 @@ import { Logger } from 'pino';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { FFmpegFilterOption, FFmpegFilterOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const ffmpegFilterOptions: FFmpegFilterOptions = config.get('ffmpegFilterOptions');
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class LeaveCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -36,7 +36,7 @@ class LeaveCommand extends BaseSlashCommandInteraction {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor(await this.getEmbedAuthor(interaction))
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.success} Leaving channel**\nCleared the track queue and left voice channel.\n\nTo play more music, use the **\`/play\`** command!`
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GuildQueue, QueueRepeatMode, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { EmbedBuilder, SlashCommandBuilder, SlashCommandStringOption } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class LoopCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -106,14 +106,6 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
||||
});
|
||||
}
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
if (queue.repeatMode === 0) {
|
||||
logger.debug('Disabled loop mode.');
|
||||
|
||||
@@ -122,10 +114,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.success} Loop mode disabled**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${currentModeUserString} will no longer play on repeat!`
|
||||
)
|
||||
@@ -141,10 +130,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${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!`
|
||||
)
|
||||
@@ -159,10 +145,7 @@ class LoopCommand extends BaseSlashCommandInteraction {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.looping} Loop mode changed**\nChanging loop mode from **\`${currentModeUserString}\`** to **\`${modeUserString}\`**.\n\nThe ${modeUserString} will now play on repeat!`
|
||||
)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { LyricsData, lyricsExtractor } from '@discord-player/extractor';
|
||||
import { GuildQueue, Player, QueryType, useMainPlayer, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class LyricsCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
|
||||
@@ -10,11 +10,11 @@ import {
|
||||
EmbedBuilder,
|
||||
SlashCommandBuilder
|
||||
} from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { PlayerOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType, TrackMetadata } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||
|
||||
@@ -132,10 +132,7 @@ class NowPlayingCommand extends BaseSlashCommandInteraction {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
||||
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue))
|
||||
.setDescription(
|
||||
(queue.node.isPaused()
|
||||
? '**Currently Paused**\n'
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class PauseCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -42,22 +41,11 @@ class PauseCommand extends BaseSlashCommandInteraction {
|
||||
queue.node.setPaused(!queue.node.isPaused());
|
||||
logger.debug(`Set paused state to ${queue.node.isPaused()}.`);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.pauseResumed} ${
|
||||
queue.node.isPaused() ? 'Paused Track' : 'Resumed track'
|
||||
|
||||
@@ -238,22 +238,11 @@ class PlayCommand extends BaseSlashCommandInteraction {
|
||||
if (searchResult.playlist && searchResult.tracks.length > 1) {
|
||||
logger.debug(`Playlist found and added with player.play(). Query: '${query}'`);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.success} Added playlist to queue**\n**${durationFormat} [${
|
||||
track.title
|
||||
@@ -270,22 +259,11 @@ class PlayCommand extends BaseSlashCommandInteraction {
|
||||
if (queue && queue.currentTrack === track && queue.tracks.data.length === 0) {
|
||||
logger.debug(`Track found and added with player.play(), started playing. Query: '${query}'.`);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.audioStartedPlaying} Started playing**\n**${durationFormat} [${
|
||||
track.title
|
||||
@@ -299,22 +277,11 @@ class PlayCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
logger.debug(`Track found and added with player.play(), added to queue. Query: '${query}'.`);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`${this.embedOptions.icons.success} **Added to queue**\n**${durationFormat} [${track.title}](${
|
||||
track.raw.url ?? track.url
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import config from 'config';
|
||||
import { GuildQueue, PlayerTimestamp, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { PlayerOptions } from '../../../types/configTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
const playerOptions: PlayerOptions = config.get('playerOptions');
|
||||
|
||||
@@ -103,10 +103,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
||||
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue))
|
||||
.setDescription(
|
||||
`${repeatModeString}` +
|
||||
`**${this.embedOptions.icons.queue} Tracks in queue**\n${queueString}`
|
||||
@@ -141,10 +138,7 @@ class QueueCommand extends BaseSlashCommandInteraction {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: `Channel: ${queue.channel!.name} (${queue.channel!.bitrate / 1000}kbps)`,
|
||||
iconURL: interaction.guild!.iconURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedQueueAuthor(interaction, queue))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.audioPlaying} Now playing**\n` +
|
||||
(currentTrack
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class RemoveCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -63,22 +63,11 @@ class RemoveCommand extends BaseSlashCommandInteraction {
|
||||
durationFormat = `${this.embedOptions.icons.liveTrack} \`LIVE\``;
|
||||
}
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.success} Removed track**\n**${durationFormat} [${
|
||||
removedTrack.title
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class SeekCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -141,22 +141,11 @@ class SeekCommand extends BaseSlashCommandInteraction {
|
||||
queue.node.seek(durationInMilliseconds);
|
||||
logger.debug(`Seeked to '${durationString}' in current track.`);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.success} Seeking to duration**\nSeeking to **\`${durationString}\`** in current track.`
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkQueueExists, checkQueueEmpty } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueEmpty, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class ShuffleCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -31,22 +31,11 @@ class ShuffleCommand extends BaseSlashCommandInteraction {
|
||||
queue.tracks.shuffle();
|
||||
logger.debug('Shuffled queue tracks.');
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${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\`**.`
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GuildQueue, Track, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkQueueExists, checkQueueCurrentTrack } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueCurrentTrack, checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class SkipCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -63,22 +63,11 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
||||
queue.node.skipTo(skipToTrack - 1);
|
||||
logger.debug('Skipped to specified track number.');
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||
skippedTrack.title
|
||||
@@ -134,22 +123,11 @@ class SkipCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
const repeatModeString: string = queue.repeatMode === 0 ? '' : getRepeatModeMessage(queue.repeatMode);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.skipped} Skipped track**\n**${durationFormat} [${
|
||||
skippedTrack.title
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class StopCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -34,22 +34,11 @@ class StopCommand extends BaseSlashCommandInteraction {
|
||||
logger.debug('Cleared and stopped the queue.');
|
||||
}
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.success} Stopped playing**\nStopped playing audio and cleared the track queue.\n\nTo play more music, use the **\`/play\`** command!`
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { GuildQueue, useQueue } from 'discord-player';
|
||||
import { EmbedBuilder, GuildMember, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkQueueExists } from '../../../utils/validation/queueValidator';
|
||||
import { checkSameVoiceChannel, checkInVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
import { checkInVoiceChannel, checkSameVoiceChannel } from '../../../utils/validation/voiceChannelValidator';
|
||||
|
||||
class VolumeCommand extends BaseSlashCommandInteraction {
|
||||
constructor() {
|
||||
@@ -72,23 +72,12 @@ class VolumeCommand extends BaseSlashCommandInteraction {
|
||||
queue.node.setVolume(volume);
|
||||
logger.debug(`Set volume to ${volume}%.`);
|
||||
|
||||
let authorName: string;
|
||||
|
||||
if (interaction.member instanceof GuildMember) {
|
||||
authorName = interaction.member.nickname || interaction.user.username;
|
||||
} else {
|
||||
authorName = interaction.user.username;
|
||||
}
|
||||
|
||||
if (volume === 0) {
|
||||
logger.debug('Responding with success embed.');
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.volumeMuted} Audio muted**\nPlayback audio has been muted, because volume was set to **\`${volume}%\`**.`
|
||||
)
|
||||
@@ -101,10 +90,7 @@ class VolumeCommand extends BaseSlashCommandInteraction {
|
||||
return await interaction.editReply({
|
||||
embeds: [
|
||||
new EmbedBuilder()
|
||||
.setAuthor({
|
||||
name: authorName,
|
||||
iconURL: interaction.user.avatarURL() || this.embedOptions.info.fallbackIconUrl
|
||||
})
|
||||
.setAuthor(await this.getEmbedUserAuthor(interaction))
|
||||
.setDescription(
|
||||
`**${this.embedOptions.icons.volumeChanged} Volume changed**\nPlayback volume has been changed to **\`${volume}%\`**.`
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
class GuildsCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ApplicationCommandOption, ApplicationCommandOptionData, EmbedBuilder, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
class ReloadCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EmbedBuilder, EmbedField, SlashCommandBuilder } from 'discord.js';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { ExtendedClient } from '../../../types/clientTypes';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType, ShardInfo } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
class ShardsCommand extends BaseSlashCommandInteraction {
|
||||
|
||||
@@ -2,8 +2,8 @@ import { EmbedBuilder, Guild, SlashCommandBuilder } from 'discord.js';
|
||||
import osu from 'node-os-utils';
|
||||
// @ts-ignore
|
||||
import { dependencies, version } from '../../../../package.json';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { BaseSlashCommandInteraction } from '../../../classes/interactions';
|
||||
import { BaseSlashCommandParams, BaseSlashCommandReturnType } from '../../../types/interactionTypes';
|
||||
import { getUptimeFormatted } from '../../../utils/system/getUptimeFormatted';
|
||||
import { checkValidGuildId } from '../../../utils/validation/systemCommandValidator';
|
||||
|
||||
|
||||
Reference in new issue
Block a user