mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
Музыка перенесена
Пакет discord-player на замену distube Фиксики и мелкие правки, как обычно
This commit is contained in:
parent
ed8cc4f0be
commit
b546036abc
25 changed files with 1282 additions and 1477 deletions
|
@ -1,115 +0,0 @@
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
|
||||||
const BaseCommand = require("../../base/BaseCommand"),
|
|
||||||
{ sendPaginatedEmbeds } = require("discord.js-embed-pagination");
|
|
||||||
|
|
||||||
class Queue extends BaseCommand {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {import("../base/JaBa")} client
|
|
||||||
*/
|
|
||||||
constructor(client) {
|
|
||||||
super({
|
|
||||||
command: new SlashCommandBuilder()
|
|
||||||
.setName("queue")
|
|
||||||
.setDescription(client.translate("music/queue:DESCRIPTION")),
|
|
||||||
aliases: [],
|
|
||||||
dirname: __dirname,
|
|
||||||
guildOnly: true,
|
|
||||||
ownerOnly: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {import("../../base/JaBa")} client
|
|
||||||
*/
|
|
||||||
async onLoad() {
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {import("../../base/JaBa")} client
|
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
||||||
* @param {Array} data
|
|
||||||
*/
|
|
||||||
async execute(client, interaction) {
|
|
||||||
const voice = interaction.member.voice.channel;
|
|
||||||
const queue = client.player.getQueue(interaction);
|
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
|
||||||
|
|
||||||
if (queue.songs.length === 1) {
|
|
||||||
const embed = new EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: interaction.translate("music/queue:TITLE"),
|
|
||||||
iconURL: interaction.guild.iconURL()
|
|
||||||
})
|
|
||||||
.addFields([
|
|
||||||
{
|
|
||||||
name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
|
|
||||||
value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${interaction.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`
|
|
||||||
}
|
|
||||||
])
|
|
||||||
.setColor(client.config.embed.color);
|
|
||||||
return interaction.reply({
|
|
||||||
embeds: [embed]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const songs = queue.songs.slice(1, queue.songs.length).map(song => {
|
|
||||||
return {
|
|
||||||
name: interaction.translate("music/queue:TITLE"),
|
|
||||||
value: `**${queue.songs.indexOf(song)}**. [${song.name}](${song.url})\n*${interaction.translate("music/queue:ADDED")} ${song.member}*\n`
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
const pages = songs.map(song => {
|
|
||||||
new EmbedBuilder()
|
|
||||||
.setAuthor({
|
|
||||||
name: interaction.translate("music/queue:TITLE"),
|
|
||||||
iconURL: interaction.guild.iconURL()
|
|
||||||
})
|
|
||||||
.setColor(client.config.embed.color)
|
|
||||||
.addFields([
|
|
||||||
// {
|
|
||||||
// name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
|
|
||||||
// value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${interaction.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`
|
|
||||||
// },
|
|
||||||
...songs
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
|
|
||||||
sendPaginatedEmbeds(interaction, pages, {
|
|
||||||
previousLabel: interaction.translate("music/queue:"),
|
|
||||||
nextLabel: interaction.translate("music/queue:"),
|
|
||||||
pageLabel: interaction.translate("music/queue:"),
|
|
||||||
content: `${interaction.translate("music/nowplaying:CURRENTLY_PLAYING")}\n[${queue.songs[0].name}](${queue.songs[0].url})\n*${interaction.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`,
|
|
||||||
showPagePosition: true,
|
|
||||||
time: 120000
|
|
||||||
});
|
|
||||||
|
|
||||||
// FieldsEmbed.embed
|
|
||||||
// .setColor(client.config.embed.color)
|
|
||||||
// .setAuthor({
|
|
||||||
// name: interaction.translate("music/queue:TITLE"),
|
|
||||||
// iconURL: interaction.guild.iconURL()
|
|
||||||
// })
|
|
||||||
// .addFields([
|
|
||||||
// {
|
|
||||||
// name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
|
|
||||||
// value: `[${queue.songs[0].name}](${queue.songs[0].url})\n*${interaction.translate("music/queue:ADDED")} ${queue.songs[0].member}*\n`
|
|
||||||
// }
|
|
||||||
// ]);
|
|
||||||
// FieldsEmbed
|
|
||||||
// .setArray(queue.songs[1] ? queue.songs.slice(1, queue.songs.length) : [])
|
|
||||||
// .setAuthorizedUsers([interaction.member.id])
|
|
||||||
// .setChannel(interaction.channel)
|
|
||||||
// .setElementsPerPage(5)
|
|
||||||
// .setDeleteOnTimeout(true)
|
|
||||||
// .setPageIndicator(true)
|
|
||||||
// .formatField(interaction.translate("music/queue:TITLE"), (track) => `**${queue.songs.indexOf(track)}**. [${track.name}](${track.url})\n*${interaction.translate("music/queue:ADDED")} ${track.member}*\n`)
|
|
||||||
// .build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Queue;
|
|
68
base/JaBa.js
68
base/JaBa.js
|
@ -1,8 +1,9 @@
|
||||||
const { EmbedBuilder, Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder } = require("discord.js"),
|
const {/* EmbedBuilder, */Client, Collection, SlashCommandBuilder, ContextMenuCommandBuilder } = require("discord.js"),
|
||||||
{ GiveawaysManager } = require("discord-giveaways"),
|
{ GiveawaysManager } = require("discord-giveaways"),
|
||||||
{ SoundCloudPlugin } = require("@distube/soundcloud"),
|
// { SoundCloudPlugin } = require("@distube/soundcloud"),
|
||||||
{ SpotifyPlugin } = require("@distube/spotify"),
|
// { SpotifyPlugin } = require("@distube/spotify"),
|
||||||
{ YtDlpPlugin } = require("@distube/yt-dlp"),
|
// { YtDlpPlugin } = require("@distube/yt-dlp"),
|
||||||
|
{ Player } = require("discord-player"),
|
||||||
{ REST } = require("@discordjs/rest"),
|
{ REST } = require("@discordjs/rest"),
|
||||||
{ Routes } = require("discord-api-types/v10");
|
{ Routes } = require("discord-api-types/v10");
|
||||||
|
|
||||||
|
@ -13,7 +14,7 @@ const BaseEvent = require("./BaseEvent.js"),
|
||||||
path = require("path"),
|
path = require("path"),
|
||||||
fs = require("fs").promises,
|
fs = require("fs").promises,
|
||||||
mongoose = require("mongoose"),
|
mongoose = require("mongoose"),
|
||||||
DisTube = require("distube"),
|
// DisTube = require("distube"),
|
||||||
moment = require("moment");
|
moment = require("moment");
|
||||||
|
|
||||||
moment.relativeTimeThreshold("s", 60);
|
moment.relativeTimeThreshold("s", 60);
|
||||||
|
@ -52,60 +53,35 @@ class JaBa extends Client {
|
||||||
|
|
||||||
this.discordTogether = new DiscordTogether(this);
|
this.discordTogether = new DiscordTogether(this);
|
||||||
|
|
||||||
this.player = new DisTube.default(this, {
|
this.player = new Player(this, {
|
||||||
plugins: [
|
autoRegisterExtractor: true,
|
||||||
new SpotifyPlugin({
|
leaveOnEnd: true,
|
||||||
emitEventsAfterFetching: true
|
leaveOnStop: true
|
||||||
}),
|
|
||||||
new SoundCloudPlugin(),
|
|
||||||
new YtDlpPlugin()
|
|
||||||
],
|
|
||||||
directLink: true,
|
|
||||||
emitNewSongOnly: true,
|
|
||||||
leaveOnEmpty: true,
|
|
||||||
leaveOnFinish: true,
|
|
||||||
leaveOnStop: true,
|
|
||||||
searchSongs: 10,
|
|
||||||
searchCooldown: 30,
|
|
||||||
emptyCooldown: 10,
|
|
||||||
emitAddListWhenCreatingQueue: false,
|
|
||||||
emitAddSongWhenCreatingQueue: false
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.player
|
this.player
|
||||||
.on("playSong", async (queue, song) => {
|
.on("trackStart", async (queue, track) => {
|
||||||
const m = await queue.textChannel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: song.name }, queue.textChannel.guild.data.language) });
|
const m = await queue.metadata.channel.send({ content: this.translate("music/play:NOW_PLAYING", { songName: track.title }, queue.metadata.channel.guild.data.language) });
|
||||||
if (song.duration > 1) {
|
if (track.durationMS > 1) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (m.deletable) m.delete();
|
if (m.deletable) m.delete();
|
||||||
}, song.duration * 1000);
|
}, track.durationMS * 1000);
|
||||||
} else {
|
} else {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (m.deletable) m.delete();
|
if (m.deletable) m.delete();
|
||||||
}, 10 * 60 * 1000); // m * s * ms
|
}, 10 * 60 * 1000); // m * s * ms
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.on("addSong", (queue, song) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE", { songName: song.name }, queue.textChannel.guild.data.language) }))
|
.on("queueEnd", queue => queue.metadata.channel.send(this.translate("music/play:QUEUE_ENDED", null, queue.metadata.channel.guild.data.language)))
|
||||||
.on("addList", (queue, playlist) => queue.textChannel.send({ content: this.translate("music/play:ADDED_QUEUE_COUNT", { songCount: `**${playlist.songs.length}** ${this.getNoun(playlist.songs.length, this.translate("misc:NOUNS:TRACKS:1"), this.translate("misc:NOUNS:TRACKS:1"), this.translate("misc:NOUNS:TRACKS:2"), this.translate("misc:NOUNS:TRACKS:5"))}` }, queue.textChannel.guild.data.language) }))
|
.on("channelEmpty", queue => queue.metadata.channel.send(this.translate("music/play:STOP_EMPTY", null, queue.metadata.channel.guild.data.language)))
|
||||||
.on("searchResult", (message, result) => {
|
.on("connectionError", (queue, e) => {
|
||||||
let i = 0;
|
|
||||||
const embed = new EmbedBuilder()
|
|
||||||
.setDescription(result.map(song => `**${++i}** - ${song.name}`).join("\n"))
|
|
||||||
.setFooter({ text: this.translate("music/play:RESULTS_FOOTER", null, message.guild.data.language) })
|
|
||||||
.setColor(this.config.embed.color);
|
|
||||||
message.reply({ embeds: [embed] });
|
|
||||||
})
|
|
||||||
.on("searchDone", () => {})
|
|
||||||
.on("searchCancel", message => message.error("misc:TIMES_UP"))
|
|
||||||
.on("searchInvalidAnswer", message => message.error("misc:INVALID_NUMBER_RANGE", { min: 1, max: 10 }))
|
|
||||||
.on("searchNoResult", message => message.error("music/play:NO_RESULT"))
|
|
||||||
.on("error", (textChannel, e) => {
|
|
||||||
console.error(e);
|
console.error(e);
|
||||||
textChannel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e }, textChannel.guild.data.language) });
|
queue.metadata.channel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e.message }, queue.metadata.channel.guild.data.language) });
|
||||||
})
|
})
|
||||||
.on("finish", queue => queue.textChannel.send(this.translate("music/play:QUEUE_ENDED", null, queue.textChannel.guild.data.language)))
|
.on("error", (queue, e) => {
|
||||||
// .on("disconnect", queue => queue.textChannel.send(this.translate("music/play:STOP_DISCONNECTED", null, queue.textChannel.guild.data.language)))
|
console.error(e);
|
||||||
.on("empty", queue => queue.textChannel.send(this.translate("music/play:STOP_EMPTY", null, queue.textChannel.guild.data.language)));
|
queue.metadata.channel.send({ content: this.translate("music/play:ERR_OCCURRED", { error: e.message }, queue.metadata.channel.guild.data.language) });
|
||||||
|
});
|
||||||
|
|
||||||
this.giveawaysManager = new GiveawaysManager(this, {
|
this.giveawaysManager = new GiveawaysManager(this, {
|
||||||
storage: "./giveaways.json",
|
storage: "./giveaways.json",
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
const { SlashCommandBuilder } = require("discord.js");
|
|
||||||
const BaseCommand = require("../../base/BaseCommand");
|
|
||||||
|
|
||||||
class AutoPlay extends BaseCommand {
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {import("../base/JaBa")} client
|
|
||||||
*/
|
|
||||||
constructor(client) {
|
|
||||||
super({
|
|
||||||
command: new SlashCommandBuilder()
|
|
||||||
.setName("autoplay")
|
|
||||||
.setDescription(client.translate("music/autoplay:DESCRIPTION")),
|
|
||||||
aliases: [],
|
|
||||||
dirname: __dirname,
|
|
||||||
guildOnly: true,
|
|
||||||
ownerOnly: false
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {import("../../base/JaBa")} client
|
|
||||||
*/
|
|
||||||
async onLoad() {
|
|
||||||
//...
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {import("../../base/JaBa")} client
|
|
||||||
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
||||||
* @param {Array} data
|
|
||||||
*/
|
|
||||||
async execute(client, interaction) {
|
|
||||||
const voice = interaction.member.voice.channel;
|
|
||||||
const queue = client.player.getQueue(interaction);
|
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { ephemeral: true });
|
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { ephemeral: true });
|
|
||||||
|
|
||||||
const autoplay = queue.toggleAutoplay();
|
|
||||||
|
|
||||||
interaction.success(`music/autoplay:SUCCESS_${autoplay ? "ENABLED" : "DISABLED"}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = AutoPlay;
|
|
|
@ -32,27 +32,24 @@ class Back extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
const queue = client.player.getQueue(interaction);
|
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { ephemeral: true });
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { ephemeral: true });
|
||||||
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { ephemeral: true });
|
if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { ephemeral: true });
|
||||||
if (!queue.previousSongs[0]) return interaction.error("music/back:NO_PREV_SONG", null, { ephemeral: true });
|
if (!queue.previousTracks[0]) return interaction.error("music/back:NO_PREV_SONG", null, { ephemeral: true });
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: interaction.translate("music/back:DESCRIPTION")
|
name: interaction.translate("music/back:SUCCESS")
|
||||||
})
|
})
|
||||||
.setThumbnail(queue.tracks[0].thumbnail)
|
.setThumbnail(queue.current.thumbnail)
|
||||||
.setDescription(interaction.translate("music/back:SUCCESS"))
|
.setDescription(`[${queue.current.title}](${queue.current.url})`)
|
||||||
.setColor(client.config.embed.color)
|
.setColor(client.config.embed.color)
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: client.config.embed.footer
|
text: client.config.embed.footer
|
||||||
});
|
});
|
||||||
client.player.previous(interaction);
|
|
||||||
|
|
||||||
interaction.reply({
|
queue.back()
|
||||||
embeds: [embed]
|
.then(() => interaction.reply({ embeds: [embed] }));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,6 @@ class Clips extends BaseCommand {
|
||||||
|
|
||||||
const msg = await interaction.reply({
|
const msg = await interaction.reply({
|
||||||
content: interaction.translate("music/clips:AVAILABLE_CLIPS"),
|
content: interaction.translate("music/clips:AVAILABLE_CLIPS"),
|
||||||
ephemeral: true,
|
|
||||||
components: [row],
|
components: [row],
|
||||||
fetchReply: true
|
fetchReply: true
|
||||||
});
|
});
|
||||||
|
@ -68,13 +67,11 @@ class Clips extends BaseCommand {
|
||||||
collector.on("collect", async msg => {
|
collector.on("collect", async msg => {
|
||||||
const clip = msg?.values[0];
|
const clip = msg?.values[0];
|
||||||
const voice = msg.member.voice.channel;
|
const voice = msg.member.voice.channel;
|
||||||
const queue = client.player.getQueue(msg);
|
if (!voice) return msg.update({ content: interaction.translate("music/play:NO_VOICE_CHANNEL"), components: [] });
|
||||||
|
const queue = client.player.getQueue(msg.guild.id);
|
||||||
if (!voice) return msg.error("music/play:NO_VOICE_CHANNEL");
|
if (queue) return msg.update({ content: interaction.translate("music/clips:ACTIVE_QUEUE"), components: [] });
|
||||||
if (getVoiceConnection(msg.guild.id)) return msg.error("music/clip:ACTIVE_CLIP");
|
if (getVoiceConnection(msg.guild.id)) return msg.update({ content: interaction.translate("music/clips:ACTIVE_CLIP"), components: [] });
|
||||||
if (queue) return msg.error("music/clip:ACTIVE_QUEUE");
|
if (!fs.existsSync(`./clips/${clip}.mp3`)) return msg.update({ content: interaction.translate("music/clips:NO_FILE", { file: clip }), components: [] });
|
||||||
if (!clip) return msg.error("music/clip:NO_ARG");
|
|
||||||
if (!fs.existsSync(`./clips/${clip}.mp3`)) return msg.error("music/clip:NO_FILE", { file: clip });
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const connection = joinVoiceChannel({
|
const connection = joinVoiceChannel({
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const { SlashCommandBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, ComponentType } = require("discord.js");
|
const { SlashCommandBuilder, ActionRowBuilder, SelectMenuBuilder, InteractionCollector, ComponentType } = require("discord.js"),
|
||||||
|
{ QueueRepeatMode } = require("discord-player");
|
||||||
const BaseCommand = require("../../base/BaseCommand");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
class Loop extends BaseCommand {
|
class Loop extends BaseCommand {
|
||||||
|
@ -32,31 +33,37 @@ class Loop extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
const queue = client.player.getQueue(interaction);
|
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
||||||
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
||||||
|
|
||||||
const row = new ActionRowBuilder()
|
const row = new ActionRowBuilder()
|
||||||
.addComponents(
|
.addComponents(
|
||||||
new SelectMenuBuilder()
|
new SelectMenuBuilder()
|
||||||
.setCustomId("nsfw_select")
|
.setCustomId("loop_select")
|
||||||
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
.setPlaceholder(client.translate("common:NOTHING_SELECTED"))
|
||||||
.addOptions([
|
.addOptions([
|
||||||
{
|
{
|
||||||
label: client.translate("music/loop:QUEUE"),
|
label: client.translate("music/loop:AUTOPLAY"),
|
||||||
value: "queue"
|
value: QueueRepeatMode.AUTOPLAY.toString()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: client.translate("music/loop:SONG"),
|
label: client.translate("music/loop:QUEUE"),
|
||||||
value: "song"
|
value: QueueRepeatMode.QUEUE.toString()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: client.translate("music/loop:TRACK"),
|
||||||
|
value: QueueRepeatMode.TRACK.toString()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: client.translate("music/loop:DISABLE"),
|
||||||
|
value: QueueRepeatMode.OFF.toString()
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
|
|
||||||
const msg = await interaction.reply({
|
const msg = await interaction.reply({
|
||||||
content: interaction.translate("common:AVAILABLE_CATEGORIES"),
|
content: interaction.translate("common:AVAILABLE_CATEGORIES"),
|
||||||
ephemeral: true,
|
|
||||||
components: [row],
|
components: [row],
|
||||||
fetchReply: true
|
fetchReply: true
|
||||||
});
|
});
|
||||||
|
@ -68,19 +75,11 @@ class Loop extends BaseCommand {
|
||||||
});
|
});
|
||||||
|
|
||||||
collector.on("collect", async msg => {
|
collector.on("collect", async msg => {
|
||||||
const type = msg?.values[0];
|
const type = Number(msg?.values[0]);
|
||||||
let mode = null;
|
queue.setRepeatMode(type);
|
||||||
|
|
||||||
if (type === "queue") {
|
|
||||||
mode = client.player.setRepeatMode(interaction, 2);
|
|
||||||
} else if (type === "song") {
|
|
||||||
mode = client.player.setRepeatMode(interaction, 1);
|
|
||||||
} else {
|
|
||||||
mode = client.player.setRepeatMode(interaction, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
await msg.update({
|
await msg.update({
|
||||||
content: `music/loop:${mode ? mode === 2 ? "QUEUE_ENABLED" : "SONG_ENABLED" : "DISABLED"}`,
|
content: interaction.translate(`music/loop:${type === 3 ? "AUTOPLAY_ENABLED" :
|
||||||
|
type === 2 ? "QUEUE_ENABLED" : type === 1 ? "TRACK_ENABLED" : "LOOP_DISABLED"}`),
|
||||||
components: []
|
components: []
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"),
|
||||||
|
{ QueueRepeatMode } = require("discord-player");
|
||||||
const BaseCommand = require("../../base/BaseCommand");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
class Nowplaying extends BaseCommand {
|
class Nowplaying extends BaseCommand {
|
||||||
|
@ -31,24 +32,11 @@ class Nowplaying extends BaseCommand {
|
||||||
* @param {Array} data
|
* @param {Array} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
await interaction.deferReply();
|
||||||
const queue = client.player.getQueue(interaction);
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
||||||
|
const progressBar = queue.createProgressBar();
|
||||||
const track = queue.songs[0];
|
const track = queue.current;
|
||||||
|
|
||||||
const status = queue =>
|
|
||||||
`${interaction.translate("music/nowplaying:REPEAT")}: \`${
|
|
||||||
queue.repeatMode
|
|
||||||
? queue.repeatMode === 2 ? interaction.translate("music/nowplaying:QUEUE") : interaction.translate("music/nowplaying:SONG")
|
|
||||||
: interaction.translate("music/nowplaying:DISABLED")
|
|
||||||
}\` | ${interaction.translate("music/nowplaying:AUTOPLAY")}: \`${
|
|
||||||
queue.autoplay
|
|
||||||
? interaction.translate("music/nowplaying:ENABLED")
|
|
||||||
: interaction.translate("music/nowplaying:DISABLED")
|
|
||||||
}\``;
|
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
|
@ -58,19 +46,22 @@ class Nowplaying extends BaseCommand {
|
||||||
.addFields([
|
.addFields([
|
||||||
{
|
{
|
||||||
name: interaction.translate("music/nowplaying:T_TITLE"),
|
name: interaction.translate("music/nowplaying:T_TITLE"),
|
||||||
value: `[${track.name}](${track.url})`
|
value: `[${track.title}](${track.url})`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: interaction.translate("music/nowplaying:T_CHANNEL"),
|
name: interaction.translate("music/nowplaying:T_AUTHOR"),
|
||||||
value: track.uploader.name || interaction.translate("common:UNKNOWN")
|
value: track.author || interaction.translate("common:UNKNOWN")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: interaction.translate("music/nowplaying:T_DURATION"),
|
name: interaction.translate("music/nowplaying:T_DURATION"),
|
||||||
value: `${queue.formattedCurrentTime} / ${track.duration > 1 ? track.formattedDuration : interaction.translate("music/play:LIVE")}`
|
value: progressBar
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: interaction.translate("music/nowplaying:T_CONF"),
|
name: "\u200b",
|
||||||
value: status(queue)
|
value: `${interaction.translate("music/nowplaying:REPEAT")}: \`${
|
||||||
|
queue.repeatMode === QueueRepeatMode.AUTOPLAY ? interaction.translate("music/nowplaying:AUTOPLAY") : queue.repeatMode === QueueRepeatMode.QUEUE ? interaction.translate("music/nowplaying:QUEUE") : queue.repeatMode === QueueRepeatMode.TRACK ? interaction.translate("music/nowplaying:TRACK")
|
||||||
|
: interaction.translate("music/nowplaying:DISABLED")
|
||||||
|
}\``
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
.setColor(client.config.embed.color)
|
.setColor(client.config.embed.color)
|
||||||
|
@ -79,7 +70,7 @@ class Nowplaying extends BaseCommand {
|
||||||
})
|
})
|
||||||
.setTimestamp();
|
.setTimestamp();
|
||||||
|
|
||||||
interaction.reply({
|
interaction.editReply({
|
||||||
embeds: [embed]
|
embeds: [embed]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
|
const { SlashCommandBuilder, PermissionsBitField } = require("discord.js"),
|
||||||
|
{ QueryType } = require("discord-player");
|
||||||
const BaseCommand = require("../../base/BaseCommand");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
class Play extends BaseCommand {
|
class Play extends BaseCommand {
|
||||||
|
@ -11,8 +12,8 @@ class Play extends BaseCommand {
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
.setName("play")
|
.setName("play")
|
||||||
.setDescription(client.translate("music/play:DESCRIPTION"))
|
.setDescription(client.translate("music/play:DESCRIPTION"))
|
||||||
.addStringOption(option => option.setName("link")
|
.addStringOption(option => option.setName("query")
|
||||||
.setDescription(client.translate("music/play:LINK"))
|
.setDescription(client.translate("music/play:QUERY"))
|
||||||
.setRequired(true)),
|
.setRequired(true)),
|
||||||
aliases: [],
|
aliases: [],
|
||||||
dirname: __dirname,
|
dirname: __dirname,
|
||||||
|
@ -35,24 +36,51 @@ class Play extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply();
|
await interaction.deferReply();
|
||||||
|
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
const link = interaction.options.getString("link");
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
||||||
|
const query = interaction.options.getString("query");
|
||||||
const perms = voice.permissionsFor(client.user);
|
const perms = voice.permissionsFor(client.user);
|
||||||
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT");
|
if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT");
|
||||||
|
|
||||||
|
const searchResult = await client.player.search(query, {
|
||||||
|
requestedBy: interaction.user,
|
||||||
|
searchEngine: query.includes("soundcloud") ? QueryType.SOUNDCLOUD_SEARCH : QueryType.AUTO
|
||||||
|
}).catch(() => {});
|
||||||
|
if (!searchResult || !searchResult.tracks.length) return interaction.editReply({
|
||||||
|
content: interaction.translate("music/play:NO_RESULT", {
|
||||||
|
query
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
const queue = client.player.getQueue(interaction.guildId) || client.player.createQueue(interaction.guild, {
|
||||||
|
metadata: {
|
||||||
|
channel: interaction.channel
|
||||||
|
},
|
||||||
|
ytdlOptions: {
|
||||||
|
filter: "audioonly",
|
||||||
|
highWaterMark: 1 << 30,
|
||||||
|
dlChunkSize: 0,
|
||||||
|
liveBuffer: 4900
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!queue.tracks[0]) {
|
||||||
|
searchResult.playlist ? queue.addTracks(searchResult.tracks) : queue.addTrack(searchResult.tracks[0]);
|
||||||
|
} else {
|
||||||
|
searchResult.playlist ? searchResult.tracks.forEach(track => queue.insert(track)) : queue.insert(searchResult.tracks[0]);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
client.player.play(interaction.member.voice.channel, link, {
|
if (!queue.connection) await queue.connect(interaction.member.voice.channel);
|
||||||
member: interaction.member,
|
if (!queue.playing) await queue.play();
|
||||||
textChannel: interaction.channel
|
|
||||||
});
|
|
||||||
|
|
||||||
interaction.editReply({
|
interaction.editReply({
|
||||||
content: interaction.translate("music/play:ADDED_QUEUE", { songName: link })
|
content: interaction.translate("music/play:ADDED_QUEUE", {
|
||||||
|
songName: searchResult.playlist ? searchResult.playlist.title : searchResult.tracks[0].title
|
||||||
|
})
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
client.player.deleteQueue(interaction.guildId);
|
||||||
interaction.error("music/play:ERR_OCCURRED", {
|
interaction.error("music/play:ERR_OCCURRED", {
|
||||||
error: e
|
error: e
|
||||||
});
|
});
|
||||||
|
|
67
commands/Music/queue.js
Normal file
67
commands/Music/queue.js
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
||||||
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
|
class Queue extends BaseCommand {
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
constructor(client) {
|
||||||
|
super({
|
||||||
|
command: new SlashCommandBuilder()
|
||||||
|
.setName("queue")
|
||||||
|
.setDescription(client.translate("music/queue:DESCRIPTION")),
|
||||||
|
aliases: [],
|
||||||
|
dirname: __dirname,
|
||||||
|
guildOnly: true,
|
||||||
|
ownerOnly: false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
*/
|
||||||
|
async onLoad() {
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param {import("../../base/JaBa")} client
|
||||||
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
||||||
|
* @param {Array} data
|
||||||
|
*/
|
||||||
|
async execute(client, interaction) {
|
||||||
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
||||||
|
|
||||||
|
const currentTrack = queue.current;
|
||||||
|
const tracks = queue.tracks.slice(0, 10).map((t, i) => {
|
||||||
|
return `${i}. [${t.title}](${t.url})\n> ${interaction.translate("music/queue:ADDED")} ${t.requestedBy}`;
|
||||||
|
});
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setAuthor({
|
||||||
|
name: interaction.translate("music/queue:TITLE"),
|
||||||
|
iconURL: interaction.guild.iconURL()
|
||||||
|
})
|
||||||
|
.setColor(client.config.embed.color)
|
||||||
|
.addFields(
|
||||||
|
{
|
||||||
|
name: interaction.translate("music/nowplaying:CURRENTLY_PLAYING"),
|
||||||
|
value: `[${currentTrack.title}](${currentTrack.url})\n> ${interaction.translate("music/queue:ADDED")} ${currentTrack.requestedBy}`
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "\u200b",
|
||||||
|
value: `${tracks.join("\n")}\n${interaction.translate("music/nowplaying:MORE", {
|
||||||
|
tracks: `${queue.tracks.length - tracks.length} ${client.getNoun(queue.tracks.length - tracks.length, interaction.translate("misc:NOUNS:TRACKS:1"), interaction.translate("misc:NOUNS:TRACKS:2"), interaction.translate("misc:NOUNS:TRACKS:5"))}`
|
||||||
|
})}`
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
interaction.reply({
|
||||||
|
embeds: [embed]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Queue;
|
|
@ -1,6 +1,5 @@
|
||||||
const { SlashCommandBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const BaseCommand = require("../../base/BaseCommand"),
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
ms = require("ms");
|
|
||||||
|
|
||||||
class Seek extends BaseCommand {
|
class Seek extends BaseCommand {
|
||||||
/**
|
/**
|
||||||
|
@ -12,8 +11,8 @@ class Seek extends BaseCommand {
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
.setName("seek")
|
.setName("seek")
|
||||||
.setDescription(client.translate("music/seek:DESCRIPTION"))
|
.setDescription(client.translate("music/seek:DESCRIPTION"))
|
||||||
.addStringOption(option => option.setName("time")
|
.addIntegerOption(option => option.setName("time")
|
||||||
.setDescription("music/seek:TIME")
|
.setDescription(client.translate("music/seek:TIME"))
|
||||||
.setRequired(true)),
|
.setRequired(true)),
|
||||||
aliases: [],
|
aliases: [],
|
||||||
dirname: __dirname,
|
dirname: __dirname,
|
||||||
|
@ -36,18 +35,13 @@ class Seek extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
const queue = client.player.getQueue(interaction);
|
|
||||||
const time = ms(interaction.options.getString("time")) / 1000;
|
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
||||||
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
||||||
if (isNaN(time)) return interaction.error("music/seek:INVALID_TIME");
|
const time = interaction.options.getInteger("time");
|
||||||
|
|
||||||
await client.player.seek(interaction, time);
|
queue.seek(time)
|
||||||
|
.then(() => interaction.replyT("music/seek:SUCCESS", { time: `${time} ${client.getNoun(time, interaction.translate("misc:NOUNS:SECONDS:1"), interaction.translate("misc:NOUNS:SECONDS:2"), interaction.translate("misc:NOUNS:SECONDS:5"))}` }));
|
||||||
interaction.replyT("music/seek:SUCCESS", {
|
|
||||||
time: ms(interaction.options.getString("time"))
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,25 +32,25 @@ class Skip extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
const queue = client.player.getQueue(interaction);
|
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
||||||
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
||||||
if (!queue.songs[1]) return interaction.error("music/skip:NO_NEXT_SONG");
|
if (!queue.tracks[1]) return interaction.error("music/skip:NO_NEXT_SONG");
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: interaction.translate("music/skip:SUCCESS")
|
name: interaction.translate("music/skip:SUCCESS")
|
||||||
})
|
})
|
||||||
.setThumbnail(queue.songs[1].thumbnail)
|
.setThumbnail(queue.tracks[1].thumbnail)
|
||||||
.setDescription(interaction.translate("music/play:NOW_PLAYING", {
|
.setDescription(interaction.translate("music/play:NOW_PLAYING", {
|
||||||
songName: queue.songs[1].name
|
songName: queue.tracks[1].name
|
||||||
}))
|
}))
|
||||||
.setFooter({
|
.setFooter({
|
||||||
text: client.config.embed.footer
|
text: client.config.embed.footer
|
||||||
})
|
})
|
||||||
.setColor(client.config.embed.color);
|
.setColor(client.config.embed.color);
|
||||||
client.player.skip(interaction);
|
|
||||||
|
queue.skip();
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed]
|
embeds: [embed]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const BaseCommand = require("../../base/BaseCommand");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
class Jump extends BaseCommand {
|
class Skipto extends BaseCommand {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../base/JaBa")} client
|
* @param {import("../base/JaBa")} client
|
||||||
|
@ -9,10 +9,10 @@ class Jump extends BaseCommand {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
super({
|
super({
|
||||||
command: new SlashCommandBuilder()
|
command: new SlashCommandBuilder()
|
||||||
.setName("jump")
|
.setName("skipto")
|
||||||
.setDescription(client.translate("music/jump:DESCRIPTION"))
|
.setDescription(client.translate("music/skipto:DESCRIPTION"))
|
||||||
.addIntegerOption(option => option.setName("position")
|
.addIntegerOption(option => option.setName("position")
|
||||||
.setDescription("music/jump:POSITION")
|
.setDescription(client.translate("music/skipto:POSITION"))
|
||||||
.setRequired(true)),
|
.setRequired(true)),
|
||||||
aliases: [],
|
aliases: [],
|
||||||
dirname: __dirname,
|
dirname: __dirname,
|
||||||
|
@ -34,32 +34,22 @@ class Jump extends BaseCommand {
|
||||||
* @param {Array} data
|
* @param {Array} data
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const queue = client.player.getQueue(interaction);
|
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
const position = interaction.options.getInteger("position");
|
const position = interaction.options.getInteger("position");
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
||||||
if (position < 0) return interaction.error("music/jump:NO_PREV_SONG");
|
if (position < 0) return interaction.error("music/skipto:NO_PREV_SONG");
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
if (queue.tracks[position]) {
|
||||||
.setAuthor({
|
queue.skipTo(queue.tracks[position]);
|
||||||
name: interaction.translate("music/jump:SUCCESS")
|
|
||||||
})
|
|
||||||
.setThumbnail(queue.songs[position].thumbnail)
|
|
||||||
.setDescription(interaction.translate("music/play:NOW_PLAYING", {
|
|
||||||
songName: queue.songs[position].name
|
|
||||||
}))
|
|
||||||
.setFooter({
|
|
||||||
text: client.config.embed.footer
|
|
||||||
})
|
|
||||||
.setColor(client.config.embed.color);
|
|
||||||
client.player.jump(interaction, position);
|
|
||||||
|
|
||||||
interaction.reply({
|
interaction.success("music/skipto:SUCCESS", {
|
||||||
embeds: [embed]
|
position
|
||||||
});
|
});
|
||||||
|
} else return interaction.error("music/skipto:ERROR", { position });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Jump;
|
module.exports = Skipto;
|
|
@ -1,4 +1,4 @@
|
||||||
const { SlashCommandBuilder, EmbedBuilder } = require("discord.js");
|
const { SlashCommandBuilder } = require("discord.js");
|
||||||
const BaseCommand = require("../../base/BaseCommand");
|
const BaseCommand = require("../../base/BaseCommand");
|
||||||
|
|
||||||
class Stop extends BaseCommand {
|
class Stop extends BaseCommand {
|
||||||
|
@ -32,24 +32,13 @@ class Stop extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
const voice = interaction.member.voice.channel;
|
const voice = interaction.member.voice.channel;
|
||||||
const queue = client.player.getQueue(interaction);
|
|
||||||
|
|
||||||
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL");
|
||||||
|
const queue = client.player.getQueue(interaction.guildId);
|
||||||
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
if (!queue) return interaction.error("music/play:NOT_PLAYING");
|
||||||
|
|
||||||
const embed = new EmbedBuilder()
|
queue.destroy();
|
||||||
.setAuthor({
|
|
||||||
name: interaction.translate("music/stop:DESCRIPTION")
|
|
||||||
})
|
|
||||||
.setDescription(interaction.translate("music/stop:SUCCESS"))
|
|
||||||
.setFooter({
|
|
||||||
text: client.config.embed.footer
|
|
||||||
})
|
|
||||||
.setColor(client.config.embed.color);
|
|
||||||
client.player.stop(interaction);
|
|
||||||
|
|
||||||
interaction.reply({
|
interaction.reply({
|
||||||
embeds: [embed]
|
content: interaction.translate("music/stop:SUCCESS")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ function dateTimePad(value, digits) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function format(tDate) {
|
function format(tDate) {
|
||||||
return (tDate.getDate() + "-" +
|
return (dateTimePad((tDate.getDate()), 2) + "-" +
|
||||||
dateTimePad((tDate.getMonth() + 1), 2) + "-" +
|
dateTimePad((tDate.getMonth() + 1), 2) + "-" +
|
||||||
dateTimePad(tDate.getFullYear(), 2) + " " +
|
dateTimePad(tDate.getFullYear(), 2) + " " +
|
||||||
dateTimePad(tDate.getHours(), 2) + ":" +
|
dateTimePad(tDate.getHours(), 2) + ":" +
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"DESCRIPTION": "Включить или отключить автовоспроизведение",
|
|
||||||
"USAGE": "autoplay",
|
|
||||||
"EXAMPLES": "autoplay",
|
|
||||||
"SUCCESS_ENABLED": "Автовоспроизведение включено!",
|
|
||||||
"SUCCESS_DISABLED": "Автовоспроизведение выключено!"
|
|
||||||
}
|
|
|
@ -3,5 +3,7 @@
|
||||||
"USAGE": "clips",
|
"USAGE": "clips",
|
||||||
"EXAMPLES": "clips",
|
"EXAMPLES": "clips",
|
||||||
"AVAILABLE_CLIPS": "Список доступных клипов:",
|
"AVAILABLE_CLIPS": "Список доступных клипов:",
|
||||||
|
"ACTIVE_QUEUE": "Не могу воспроизвести клип, т.к. на сервере есть активная очередь!",
|
||||||
|
"ACTIVE_CLIP": "Уже воспроизводится какой-то файл!",
|
||||||
"PLAYING": "Начато проигрывание клипа `{{clip}}`"
|
"PLAYING": "Начато проигрывание клипа `{{clip}}`"
|
||||||
}
|
}
|
|
@ -2,9 +2,12 @@
|
||||||
"DESCRIPTION": "Включить или отключить повтор очереди/одного трека",
|
"DESCRIPTION": "Включить или отключить повтор очереди/одного трека",
|
||||||
"USAGE": "loop",
|
"USAGE": "loop",
|
||||||
"EXAMPLES": "loop",
|
"EXAMPLES": "loop",
|
||||||
|
"AUTOPLAY": "Автовоспроизведение",
|
||||||
"QUEUE": "Очередь",
|
"QUEUE": "Очередь",
|
||||||
"SONG": "Текущий трек",
|
"TRACK": "Текущий трек",
|
||||||
|
"DISABLE": "Отключить",
|
||||||
|
"AUTOPLAY_ENABLED": "Автовоспроизведение **включено**",
|
||||||
"QUEUE_ENABLED": "Повтор очереди **включён**!",
|
"QUEUE_ENABLED": "Повтор очереди **включён**!",
|
||||||
"SONG_ENABLED": "Повтор текущего трека **включён**!",
|
"TRACK_ENABLED": "Повтор текущего трека **включён**!",
|
||||||
"DISABLED": "Повтор **отключён**!"
|
"LOOP_DISABLED": "Повтор **отключён**!"
|
||||||
}
|
}
|
|
@ -4,16 +4,14 @@
|
||||||
"EXAMPLES": "nowplaying",
|
"EXAMPLES": "nowplaying",
|
||||||
"CURRENTLY_PLAYING": "Сейчас играет",
|
"CURRENTLY_PLAYING": "Сейчас играет",
|
||||||
"T_TITLE": "Название",
|
"T_TITLE": "Название",
|
||||||
"T_CHANNEL": "Канал",
|
"T_AUTHOR": "Автор",
|
||||||
"T_DURATION": "Длительность",
|
"T_DURATION": "Длительность",
|
||||||
"T_CONF": "Настройки",
|
|
||||||
"T_DESCRIPTION": "Описание",
|
"T_DESCRIPTION": "Описание",
|
||||||
"NO_DESCRIPTION": "Описание отсутствует",
|
"NO_DESCRIPTION": "Описание отсутствует",
|
||||||
"FILTERS": "Фильтры",
|
|
||||||
"REPEAT": "Повтор",
|
"REPEAT": "Повтор",
|
||||||
"AUTOPLAY": "Автовоспроизведение",
|
"AUTOPLAY": "Автовоспроизведение",
|
||||||
"QUEUE": "Очереди",
|
"QUEUE": "Очереди",
|
||||||
"SONG": "Трека",
|
"TRACK": "Трека",
|
||||||
"ENABLED": "Вкл.",
|
"ENABLED": "Вкл.",
|
||||||
"DISABLED": "Выкл."
|
"DISABLED": "Выкл."
|
||||||
}
|
}
|
|
@ -2,21 +2,17 @@
|
||||||
"DESCRIPTION": "Начать воспроизведение трека",
|
"DESCRIPTION": "Начать воспроизведение трека",
|
||||||
"USAGE": "play [название-трека/ссылка]",
|
"USAGE": "play [название-трека/ссылка]",
|
||||||
"EXAMPLES": "play Never Gonna Give You Up",
|
"EXAMPLES": "play Never Gonna Give You Up",
|
||||||
"LINK": "Название/Прямая ссылка/Ссылка на YouTube, Spotify или SoundCloud",
|
"QUERY": "Название/Прямая ссылка/Ссылка на YouTube, Spotify или SoundCloud",
|
||||||
"NO_VOICE_CHANNEL": "Вы должны находиться в голосовом канале!",
|
"NO_VOICE_CHANNEL": "Вы должны находиться в голосовом канале!",
|
||||||
"VOICE_CHANNEL_CONNECT": "Я не могу присоедениться к вашему голосовому каналу!",
|
"VOICE_CHANNEL_CONNECT": "Я не могу присоедениться к вашему голосовому каналу!",
|
||||||
"RESULTS_FOOTER": "Укажите число от 1 до 10 (без префикса).",
|
"RESULTS_FOOTER": "Укажите число от 1 до 10 (без префикса).",
|
||||||
"NO_RESULT": "Ничего не найдено!",
|
"NO_RESULT": "По запросу `{{query}}` ничего не найдено!",
|
||||||
"NOW_PLAYING": "Сейчас играет **{{songName}}**",
|
"NOW_PLAYING": "Сейчас играет **{{songName}}**",
|
||||||
"PLAYING_PLAYLIST": "Начинается воспроизведение плейлиста **{{playlistTitle}}**. {{playlistEmoji}}\nНачато воспроизведение первого трека, **{{songName}}**!",
|
"NOT_PLAYING": "На сервере сейчас ничего не воспроизводится",
|
||||||
"CANCELLED": "Выбор отменён",
|
"QUEUE_ENDED": "Очередь окончена",
|
||||||
"NOT_PLAYING": "На сервере сейчас ничего не воспроизводится.",
|
|
||||||
"QUEUE_ENDED": "Очередь окончена.",
|
|
||||||
"ADDED_QUEUE": "**{{songName}}** добавлен в очередь!",
|
"ADDED_QUEUE": "**{{songName}}** добавлен в очередь!",
|
||||||
"ADDED_QUEUE_COUNT": "{{songCount}} добавлено в очередь!",
|
|
||||||
"STOP_DISCONNECTED": "Воспроизведение окончено, т.к. я вышел из голосового канала.",
|
"STOP_DISCONNECTED": "Воспроизведение окончено, т.к. я вышел из голосового канала.",
|
||||||
"STOP_EMPTY": "Воспроизведение окончено, т.к. все вышли из голосового канала.",
|
"STOP_EMPTY": "Воспроизведение окончено, т.к. все вышли из голосового канала.",
|
||||||
"RESULTS_CANCEL": "Поиск отменён!",
|
"RESULTS_CANCEL": "Поиск отменён!",
|
||||||
"LIVE": "Прямая трансляция",
|
|
||||||
"ERR_OCCURRED": "Произошла ошибка, пропускаю...\n`{{error}}`"
|
"ERR_OCCURRED": "Произошла ошибка, пропускаю...\n`{{error}}`"
|
||||||
}
|
}
|
|
@ -3,8 +3,6 @@
|
||||||
"USAGE": "queue",
|
"USAGE": "queue",
|
||||||
"EXAMPLES": "queue",
|
"EXAMPLES": "queue",
|
||||||
"TITLE": "Очередь",
|
"TITLE": "Очередь",
|
||||||
"PREVIOUS": "Пред. страница",
|
"ADDED": "Добавил",
|
||||||
"NEXT": "След. страница",
|
"MORE": "и ещё {{tracks}}"
|
||||||
"PAGE": "Страница",
|
|
||||||
"ADDED": "Добавил"
|
|
||||||
}
|
}
|
|
@ -2,6 +2,6 @@
|
||||||
"DESCRIPTION": "Перемотать вперед или назад на данное время в текущем треке",
|
"DESCRIPTION": "Перемотать вперед или назад на данное время в текущем треке",
|
||||||
"USAGE": "seek [время]",
|
"USAGE": "seek [время]",
|
||||||
"EXAMPLES": "seek 10s\nseek -10s",
|
"EXAMPLES": "seek 10s\nseek -10s",
|
||||||
"INVALID_TIME": "Укажите время!",
|
"TIME": "Время в секундах",
|
||||||
"SUCCESS": "Трек перемотан на {{time}}!"
|
"SUCCESS": "Трек перемотан на {{time}}!"
|
||||||
}
|
}
|
|
@ -1,7 +1,9 @@
|
||||||
{
|
{
|
||||||
"DESCRIPTION": "Перейти на заданный трек",
|
"DESCRIPTION": "Перейти на заданный трек",
|
||||||
"USAGE": "jump [номер]",
|
"USAGE": "skipto [номер]",
|
||||||
"EXAMPLES": "jump 3",
|
"EXAMPLES": "skipto 3",
|
||||||
"POSITION": "Номер трека в очереди",
|
"POSITION": "Номер трека в очереди",
|
||||||
|
"SUCCESS": "Выполнен переход на позицию {{position}",
|
||||||
|
"ERROR": "На позиции {{position}} ничего не найдено",
|
||||||
"NO_PREV_SONG": "Вы не можете перейти назад, для этого используйте команду `back`!"
|
"NO_PREV_SONG": "Вы не можете перейти назад, для этого используйте команду `back`!"
|
||||||
}
|
}
|
2143
package-lock.json
generated
2143
package-lock.json
generated
File diff suppressed because it is too large
Load diff
17
package.json
17
package.json
|
@ -12,41 +12,34 @@
|
||||||
"author": "Jonny_Bro#4226",
|
"author": "Jonny_Bro#4226",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@discord-player/extractor": "^3.0.2",
|
||||||
"@discordjs/opus": "^0.8.0",
|
"@discordjs/opus": "^0.8.0",
|
||||||
"@discordjs/rest": "^1.0.0",
|
"@discordjs/rest": "^1.0.0",
|
||||||
"@discordjs/voice": "^0.11.0",
|
"@discordjs/voice": "^0.11.0",
|
||||||
"@distube/soundcloud": "^1.2.1",
|
|
||||||
"@distube/spotify": "^1.3.2",
|
|
||||||
"@distube/yt-dlp": "^1.1.3",
|
|
||||||
"@distube/ytdl-core": "^4.11.3",
|
|
||||||
"@sindresorhus/slugify": "^1.1.0",
|
|
||||||
"amethyste-api": "github:Androz2091/amethyste-api",
|
"amethyste-api": "github:Androz2091/amethyste-api",
|
||||||
"btoa": "^1.2.1",
|
"btoa": "^1.2.1",
|
||||||
"canvacord": "^5.1.0",
|
"canvacord": "^5.1.0",
|
||||||
"canvas": "^2.9.0",
|
"canvas": "^2.9.0",
|
||||||
"chalk": "^4.1.0",
|
"chalk": "^4.1.0",
|
||||||
"colors-generator": "^0.3.4",
|
|
||||||
"cron": "^1.7.2",
|
"cron": "^1.7.2",
|
||||||
"discord-api-types": "^0.37.0",
|
"discord-api-types": "^0.37.0",
|
||||||
"discord-giveaways": "^6.0.0",
|
"discord-giveaways": "^6.0.0",
|
||||||
"discord-together": "^1.3.3",
|
"discord-player": "^5.3.0-dev.3",
|
||||||
"discord.js": "^14.1.2",
|
"discord.js": "^14.1.2",
|
||||||
"discord.js-embed-pagination": "^1.0.2",
|
|
||||||
"distube": "^4.0.3",
|
|
||||||
"ejs": "^3.1.3",
|
"ejs": "^3.1.3",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-session": "^1.17.0",
|
"express-session": "^1.17.0",
|
||||||
"ffmpeg-static": "^4.4.0",
|
"ffmpeg-static": "^4.4.1",
|
||||||
"gamedig": "^4.0.2",
|
"gamedig": "^4.0.2",
|
||||||
"i18next": "^20.2.2",
|
"i18next": "^20.2.2",
|
||||||
"i18next-node-fs-backend": "^2.1.3",
|
"i18next-node-fs-backend": "^2.1.3",
|
||||||
"libsodium-wrappers": "^0.7.10",
|
"libsodium-wrappers": "^0.7.10",
|
||||||
"markdown-table": "2.0.0",
|
"markdown-table": "2.0.0",
|
||||||
"mathjs": "^9.0.0",
|
|
||||||
"md5": "^2.2.1",
|
"md5": "^2.2.1",
|
||||||
"moment": "^2.26.0",
|
"moment": "^2.26.0",
|
||||||
"mongoose": "^5.13.14",
|
"mongoose": "^5.13.14",
|
||||||
"ms": "^2.1.3"
|
"ms": "^2.1.3",
|
||||||
|
"prism-media": "^1.3.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.5.0"
|
"eslint": "^7.5.0"
|
||||||
|
|
Loading…
Reference in a new issue