Dependencies update + minor fixes
This commit is contained in:
1 parent
145867cdde
commit
8a4f5806f3
28 files changed
+1156
-1053
No files matched your search
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
FROM node:16
|
||||
|
||||
RUN apt -y update
|
||||
RUN apt install -y ffmpeg
|
||||
RUN apt install -y python3-pip
|
||||
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
RUN mkdir bin
|
||||
RUN curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/src/app/bin/youtube-dl
|
||||
RUN chmod a+rx /usr/src/app/bin/youtube-dl
|
||||
|
||||
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
|
||||
COPY . .
|
||||
run npm run build
|
||||
|
||||
CMD [ "npm", "start" ]
|
||||
Generated
+853
-709
File diff suppressed because it is too large.
Load diff
+11
-12
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "quetza-bot",
|
||||
"engines": {
|
||||
"node": "16.14.x",
|
||||
"node": "16.x.x",
|
||||
"npm": "*"
|
||||
},
|
||||
"version": "2205.3.0",
|
||||
@@ -24,22 +24,21 @@
|
||||
"scripts": {
|
||||
"start": "node dist/index.js",
|
||||
"build": "tsc --build",
|
||||
"clean": "tsc --build --clean",
|
||||
"postinstall": "npm run build"
|
||||
"clean": "tsc --build --clean"
|
||||
},
|
||||
"dependencies": {
|
||||
"@discordjs/opus": "^0.7.0",
|
||||
"@discordjs/voice": "^0.8.0",
|
||||
"@discordjs/opus": "^0.8.0",
|
||||
"@discordjs/voice": "^0.11.0",
|
||||
"discord-ytdl-core": "^5.0.4",
|
||||
"discord.js": "^13.6.0",
|
||||
"discord.js": "^14.3.0",
|
||||
"tweetnacl": "^1.0.3",
|
||||
"ytdl-core": "^4.10.1"
|
||||
"ytdl-core": "^4.11.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^17.0.17",
|
||||
"@typescript-eslint/eslint-plugin": "^5.26.0",
|
||||
"@typescript-eslint/parser": "^5.26.0",
|
||||
"eslint": "^8.16.0",
|
||||
"typescript": "^4.5.5"
|
||||
"@types/node": "^18.7.13",
|
||||
"@typescript-eslint/eslint-plugin": "^5.35.1",
|
||||
"@typescript-eslint/parser": "^5.35.1",
|
||||
"eslint": "^8.22.0",
|
||||
"typescript": "^4.8.2"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import Client from "../lib/Client";
|
||||
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import I8n from "../lib/I8n";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
@@ -14,12 +14,11 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
player.clear();
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.cleared(amount)] });
|
||||
await ctx.reply({ embeds: [I18n.en.cleared(amount)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "clear",
|
||||
description: "Clears the player's queue.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("clear")
|
||||
.setDescription("Clear the player's queue.");
|
||||
|
||||
export { data };
|
||||
@@ -1,7 +1,7 @@
|
||||
import Client from "../lib/Client";
|
||||
|
||||
import { CommandInteraction, GuildMember } from "discord.js";
|
||||
import I8n from "../lib/I8n";
|
||||
import { CommandInteraction, GuildMember, SlashCommandBuilder } from "discord.js";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (!ctx.guild || !ctx.channel || !ctx.member) return;
|
||||
@@ -17,23 +17,22 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (channel) {
|
||||
player.connect(channel);
|
||||
|
||||
await ctx.editReply({ embeds: [I8n.en.okConnected(channel.name)] });
|
||||
await ctx.editReply({ embeds: [I18n.en.okConnected(channel.name)] });
|
||||
} else {
|
||||
client.modules.music.del(ctx.guild.id);
|
||||
|
||||
await ctx.editReply({ embeds: [I8n.en.notConnected()] });
|
||||
await ctx.editReply({ embeds: [I18n.en.notConnected()] });
|
||||
return undefined;
|
||||
}
|
||||
} else {
|
||||
await ctx.editReply({ embeds: [I8n.en.wasConnected()] });
|
||||
await ctx.editReply({ embeds: [I18n.en.wasConnected()] });
|
||||
}
|
||||
|
||||
return player;
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "connect",
|
||||
description: "Connects me to a voice channel.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("connect")
|
||||
.setDescription("Connect me to a voice channel.");
|
||||
|
||||
export { data };
|
||||
+14
-19
@@ -1,9 +1,9 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const filter = ctx.options.getString("filter");
|
||||
const filter = ctx.options.get("filter")?.value as string;
|
||||
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
|
||||
@@ -13,18 +13,16 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
player.setFilter(filter || undefined);
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.filtered(filter || undefined)] });
|
||||
await ctx.reply({ embeds: [I18n.en.filtered(filter || undefined)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "filter",
|
||||
description: "Apply unique filters to the player's tracks.",
|
||||
options: [
|
||||
{
|
||||
name: "filter",
|
||||
description: "Filter to apply...",
|
||||
type: "STRING",
|
||||
choices: [
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("filter")
|
||||
.setDescription("Apply unique filters to the tracks.")
|
||||
.addStringOption(option => option
|
||||
.setName("filter")
|
||||
.setDescription("Filter to apply.")
|
||||
.setChoices(
|
||||
{
|
||||
name: "bassboost_low",
|
||||
value: "bassboost_low",
|
||||
@@ -116,11 +114,8 @@ const data = {
|
||||
{
|
||||
name: "earrape",
|
||||
value: "earrape",
|
||||
},
|
||||
],
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
})
|
||||
.setRequired(true)
|
||||
);
|
||||
|
||||
export { data };
|
||||
@@ -1,7 +1,7 @@
|
||||
import Client from "../lib/Client";
|
||||
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import I8n from "../lib/I8n";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (!ctx.guild || !ctx.channel || !ctx.member) return;
|
||||
@@ -10,12 +10,11 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
const player = client.modules.music.get(ctx.guild.id, ctx.channel);
|
||||
|
||||
await ctx.editReply({ embeds: [I8n.en.playerInfo(player)] });
|
||||
await ctx.editReply({ embeds: [I18n.en.playerInfo(player)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "info",
|
||||
description: "Information about the server's player.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("info")
|
||||
.setDescription("Information about the playback.");
|
||||
|
||||
export { data };
|
||||
+18
-23
@@ -1,10 +1,10 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const pos = ctx.options.getInteger("position");
|
||||
const query = ctx.options.getString("query");
|
||||
const pos = ctx.options.get("position")?.value as number;
|
||||
const query = ctx.options.get("query")?.value as string;
|
||||
|
||||
if (!ctx.guild || !query || !pos || !ctx.channel) return;
|
||||
|
||||
@@ -16,26 +16,21 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
const track = await player.add(query, ctx.user, pos - 1);
|
||||
|
||||
await ctx.editReply({ embeds: [I8n.en.appended(track)] });
|
||||
await ctx.editReply({ embeds: [I18n.en.appended(track)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "insert",
|
||||
description: "Insert a new track to specific position in the queue.",
|
||||
options: [
|
||||
{
|
||||
name: "query",
|
||||
description: "Title or URL of the song.",
|
||||
type: "STRING",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: "position",
|
||||
description: "Position to insert.",
|
||||
type: "INTEGER",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("insert")
|
||||
.setDescription("Insert a new track to specific position in the queue.")
|
||||
.addStringOption(option => option
|
||||
.setName("query")
|
||||
.setDescription("Title or URL of the song.")
|
||||
.setRequired(true)
|
||||
)
|
||||
.addIntegerOption(option => option
|
||||
.setName("position")
|
||||
.setDescription("Position to insert.",)
|
||||
.setRequired(true)
|
||||
);
|
||||
|
||||
export { data };
|
||||
+12
-16
@@ -1,9 +1,9 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const query = ctx.options.getString("query");
|
||||
const query = ctx.options.get("query")?.value as string;
|
||||
|
||||
if (!ctx.guild || !query || !ctx.channel) return;
|
||||
|
||||
@@ -13,20 +13,16 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
const state = !isNaN(+query) && isFinite(+query) && !/e/i.test(query) ? player.jump(parseInt(query) - 1) : player.jump(query);
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.jumped(state)] });
|
||||
await ctx.reply({ embeds: [I18n.en.jumped(state)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "jump",
|
||||
description: "Jump to specific track in the queue.",
|
||||
options: [
|
||||
{
|
||||
name: "query",
|
||||
description: "Position or title to jump to.",
|
||||
type: "STRING",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("jump")
|
||||
.setDescription("Jump to specific track in the queue.")
|
||||
.addStringOption(option => option
|
||||
.setName("query")
|
||||
.setDescription("Position or title to jump to.")
|
||||
.setRequired(true)
|
||||
);
|
||||
|
||||
export { data };
|
||||
+13
-20
@@ -1,10 +1,10 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import { loopOption } from "../lib/Types";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const query = ctx.options.getString("option");
|
||||
const query = ctx.options.get("option")?.value as string;
|
||||
|
||||
if (!ctx.guild || !query || !ctx.channel) return;
|
||||
|
||||
@@ -14,26 +14,19 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
player.Queue.Loop = query as loopOption;
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.looped(query as loopOption)] });
|
||||
await ctx.reply({ embeds: [I18n.en.looped(query as loopOption)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "loop",
|
||||
description: "Select player's loop mode.",
|
||||
options: [
|
||||
{
|
||||
name: "option",
|
||||
description: "Loop options.",
|
||||
type: "STRING",
|
||||
required: true,
|
||||
choices: [
|
||||
{ name: "loop queue", value: "LOOP" },
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("loop")
|
||||
.setDescription("Select player's loop mode.")
|
||||
.addStringOption(option => option
|
||||
.setName("option")
|
||||
.setDescription("Select loop option.")
|
||||
.setChoices( { name: "loop queue", value: "LOOP" },
|
||||
{ name: "loop single track", value: "SONG" },
|
||||
{ name: "Till end", value: "NONE" },
|
||||
{ name: "Random order", value: "AUTO" },
|
||||
],
|
||||
},
|
||||
],
|
||||
};
|
||||
{ name: "Random order", value: "AUTO" })
|
||||
.setRequired(true));
|
||||
|
||||
export { data };
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
@@ -11,12 +11,11 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
player.skip();
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.skipped()] });
|
||||
await ctx.reply({ embeds: [I18n.en.skipped()] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "next",
|
||||
description: "Skip to the next song.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("next")
|
||||
.setDescription("Skip current song.");
|
||||
|
||||
export { data };
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
@@ -11,12 +11,11 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
const state = player.pause();
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.paused(state)] });
|
||||
await ctx.reply({ embeds: [I18n.en.paused(state)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "pause",
|
||||
description: "Toggle pause on player.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("pause")
|
||||
.setDescription("Toggle pause on player.");
|
||||
|
||||
export { data };
|
||||
@@ -1,23 +1,22 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const start = Date.now();
|
||||
|
||||
if (!client.application) {
|
||||
await ctx.reply({ embeds: [I8n.en.ping(undefined)] });
|
||||
await ctx.reply({ embeds: [I18n.en.ping(undefined)] });
|
||||
return;
|
||||
}
|
||||
|
||||
await client.application.fetch();
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.ping(Date.now() - start)] });
|
||||
await ctx.reply({ embeds: [I18n.en.ping(Date.now() - start)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "ping",
|
||||
description: "Try to ping me.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("ping")
|
||||
.setDescription("Try to ping me.");
|
||||
|
||||
export { data };
|
||||
+11
-15
@@ -1,10 +1,10 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import { run as connect } from "./connect";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const query = ctx.options.getString("query");
|
||||
const query = ctx.options.get("query")?.value as string;
|
||||
|
||||
const player = await connect(client, ctx);
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (query) {
|
||||
const track = await player.add(query, ctx.user);
|
||||
|
||||
await ctx.editReply({ embeds: [I8n.en.appended(track)] });
|
||||
await ctx.editReply({ embeds: [I18n.en.appended(track)] });
|
||||
}
|
||||
|
||||
if (!player.Resource) {
|
||||
@@ -21,16 +21,12 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
}
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "play",
|
||||
description: "Launch player and add songs to the queue.",
|
||||
options: [
|
||||
{
|
||||
name: "query",
|
||||
description: "Title or URL of the song.",
|
||||
type: "STRING"
|
||||
},
|
||||
],
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("play")
|
||||
.setDescription("Launch player and add songs to the queue.")
|
||||
.addStringOption(option => option
|
||||
.setName("query")
|
||||
.setDescription("Title or URL of the song.")
|
||||
);
|
||||
|
||||
export { data };
|
||||
+21
-19
@@ -1,13 +1,16 @@
|
||||
import {
|
||||
ActionRowBuilder,
|
||||
ButtonBuilder,
|
||||
ButtonInteraction,
|
||||
ButtonStyle,
|
||||
CommandInteraction,
|
||||
Message,
|
||||
MessageActionRow,
|
||||
MessageButton,
|
||||
MessageActionRowComponentBuilder,
|
||||
SlashCommandBuilder
|
||||
} from "discord.js";
|
||||
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
@@ -19,33 +22,33 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
await ctx.deferReply();
|
||||
|
||||
if (player.Queue.empty()) {
|
||||
await ctx.editReply({ embeds: [I8n.en.queueEmpty()] });
|
||||
await ctx.editReply({ embeds: [I18n.en.queueEmpty()] });
|
||||
return;
|
||||
}
|
||||
|
||||
let page = 0;
|
||||
|
||||
const row = new MessageActionRow().addComponents(
|
||||
new MessageButton()
|
||||
const row = new ActionRowBuilder<MessageActionRowComponentBuilder>().addComponents(
|
||||
new ButtonBuilder()
|
||||
.setCustomId("QueueTop")
|
||||
.setLabel("🔼")
|
||||
.setStyle("PRIMARY"),
|
||||
new MessageButton()
|
||||
.setStyle(ButtonStyle.Primary),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("QueueUp")
|
||||
.setLabel("🔺")
|
||||
.setStyle("SECONDARY"),
|
||||
new MessageButton()
|
||||
.setStyle(ButtonStyle.Secondary),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("QueueDown")
|
||||
.setLabel("🔻")
|
||||
.setStyle("SECONDARY"),
|
||||
new MessageButton()
|
||||
.setStyle(ButtonStyle.Secondary),
|
||||
new ButtonBuilder()
|
||||
.setCustomId("QueueEnd")
|
||||
.setLabel("🔽")
|
||||
.setStyle("PRIMARY")
|
||||
.setStyle(ButtonStyle.Primary)
|
||||
);
|
||||
|
||||
const message = (await ctx.editReply({
|
||||
embeds: [I8n.en.queueDesigner(player.Queue, 0, player.Resource)],
|
||||
embeds: [I18n.en.queueDesigner(player.Queue, 0, player.Resource)],
|
||||
components: [row],
|
||||
})) as Message;
|
||||
|
||||
@@ -70,14 +73,13 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
}
|
||||
|
||||
await btn.update({
|
||||
embeds: [I8n.en.queueDesigner(player.Queue, page, player.Resource)],
|
||||
embeds: [I18n.en.queueDesigner(player.Queue, page, player.Resource)],
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "queue",
|
||||
description: "Print out the queue.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("queue")
|
||||
.setDescription("Print out the queue.");
|
||||
|
||||
export { data };
|
||||
+12
-16
@@ -1,9 +1,9 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const query = ctx.options.getString("query");
|
||||
const query = ctx.options.get("query")?.value as string;
|
||||
|
||||
if (!ctx.guild || !query || !ctx.channel) return;
|
||||
|
||||
@@ -13,20 +13,16 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
const track = !isNaN(+query) && isFinite(+query) && !/e/i.test(query) ? player.remove(parseInt(query) - 1) : player.remove(query);
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.removed(track)] });
|
||||
await ctx.reply({ embeds: [I18n.en.removed(track)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "remove",
|
||||
description: "Remove specific track in the queue.",
|
||||
options: [
|
||||
{
|
||||
name: "query",
|
||||
description: "Position or title to remove.",
|
||||
type: "STRING",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("remove")
|
||||
.setDescription("Remove specific track in the queue.")
|
||||
.addStringOption(option => option
|
||||
.setName("query")
|
||||
.setDescription("Position or title to remove.")
|
||||
.setRequired(true)
|
||||
);
|
||||
|
||||
export { data };
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
@@ -11,12 +11,11 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
player.shuffle();
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.reshuffle()] });
|
||||
await ctx.reply({ embeds: [I18n.en.reshuffle()] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "reshuffle",
|
||||
description: "Shuffle the queue.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("reshuffle")
|
||||
.setDescription("Shuffle the queue.");
|
||||
|
||||
export { data };
|
||||
+21
-30
@@ -1,11 +1,11 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const hours = ctx.options.getInteger("hrs") || 0;
|
||||
const minutes = ctx.options.getInteger("mins") || 0;
|
||||
const seconds = ctx.options.getInteger("secs") || 0;
|
||||
const hours = ctx.options.get("hrs")?.value as number || 0;
|
||||
const minutes = ctx.options.get("mins")?.value as number || 0;
|
||||
const seconds = ctx.options.get("secs")?.value as number || 0;
|
||||
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
|
||||
@@ -18,33 +18,24 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
player.seek(time * 1000);
|
||||
|
||||
await ctx.reply({
|
||||
embeds: [I8n.en.fastForwarded(time)],
|
||||
embeds: [I18n.en.fastForwarded(time)],
|
||||
});
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "seek",
|
||||
description: "Fast-forward to the timecode.",
|
||||
options: [
|
||||
{
|
||||
name: "hrs",
|
||||
description: "Hours to seek.",
|
||||
type: "INTEGER",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
name: "mins",
|
||||
description: "Minutes to seek.",
|
||||
type: "INTEGER",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
name: "secs",
|
||||
description: "Seconds to seek.",
|
||||
type: "INTEGER",
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("seek")
|
||||
.setDescription("Fast-forward by the time.")
|
||||
.addIntegerOption(option => option
|
||||
.setName("hrs")
|
||||
.setDescription("Hours to seek.")
|
||||
)
|
||||
.addIntegerOption(option => option
|
||||
.setName("mins")
|
||||
.setDescription("Minutes to seek.")
|
||||
)
|
||||
.addIntegerOption(option => option
|
||||
.setName("secs")
|
||||
.setDescription("Seconds to seek.")
|
||||
);
|
||||
|
||||
export { data };
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
@@ -11,12 +11,11 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
player.destroy();
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.destroyed()] });
|
||||
await ctx.reply({ embeds: [I18n.en.destroyed()] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "stop",
|
||||
description: "Destroys the player.",
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("stop")
|
||||
.setDescription("Destroy the player.");
|
||||
|
||||
export { data };
|
||||
+12
-16
@@ -1,9 +1,9 @@
|
||||
import { CommandInteraction } from "discord.js";
|
||||
import { CommandInteraction, SlashCommandBuilder } from "discord.js";
|
||||
import Client from "../lib/Client";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
|
||||
export async function run(client: Client, ctx: CommandInteraction) {
|
||||
const volume = ctx.options.getInteger("volume") || 100;
|
||||
const volume = ctx.options.get("volume")?.value as number || 100;
|
||||
|
||||
if (!ctx.guild || !ctx.channel) return;
|
||||
|
||||
@@ -13,20 +13,16 @@ export async function run(client: Client, ctx: CommandInteraction) {
|
||||
|
||||
player.Volume = volume;
|
||||
|
||||
await ctx.reply({ embeds: [I8n.en.volumeSet(player.Volume)] });
|
||||
await ctx.reply({ embeds: [I18n.en.volumeSet(player.Volume)] });
|
||||
}
|
||||
|
||||
const data = {
|
||||
name: "volume",
|
||||
description: "Change player's volume amount.",
|
||||
options: [
|
||||
{
|
||||
name: "volume",
|
||||
description: "Volume in percents.",
|
||||
type: "INTEGER",
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
const data = new SlashCommandBuilder()
|
||||
.setName("volume")
|
||||
.setDescription("Change player's volume amount.")
|
||||
.addIntegerOption(option => option
|
||||
.setName("volume")
|
||||
.setDescription("Volume in percents.")
|
||||
.setRequired(true)
|
||||
);
|
||||
|
||||
export { data };
|
||||
+2
-1
@@ -1,5 +1,6 @@
|
||||
import Client from "../lib/Client";
|
||||
import { generateDependencyReport } from "@discordjs/voice";
|
||||
import { ActivityType } from "discord.js";
|
||||
|
||||
export async function run(client: Client): Promise<void> {
|
||||
if (!client.user || !client.application) {
|
||||
@@ -9,7 +10,7 @@ export async function run(client: Client): Promise<void> {
|
||||
|
||||
console.log(`${client.user.username} logged in as ${client.user.tag}!`);
|
||||
console.log(generateDependencyReport());
|
||||
client.user.setActivity("over you", { type: "WATCHING" });
|
||||
client.user.setActivity("over you", { type: ActivityType.Watching });
|
||||
|
||||
const restCommands = Array.from(client.Commands.values()).map(
|
||||
value => value.data
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { VoiceState } from "discord.js";
|
||||
import I8n from "../lib/I8n";
|
||||
import I18n from "../lib/I18n";
|
||||
import Client from "../lib/Client";
|
||||
import { asleep } from "../lib/Misc";
|
||||
|
||||
@@ -14,7 +14,7 @@ export async function run(client: Client, args: VoiceState[]): Promise<void> {
|
||||
if (oldState.channel.members.filter(value => value.user !== client.user).size === 0) {
|
||||
await asleep(30000);
|
||||
if (oldState.channel.members.filter(value => value.user !== client.user).size === 0) {
|
||||
await player.Channel.send({ embeds: [I8n.en.fullyAlone()] });
|
||||
await player.Channel.send({ embeds: [I18n.en.fullyAlone()] });
|
||||
player.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-5
@@ -1,6 +1,5 @@
|
||||
import {
|
||||
Client as DiscordClient,
|
||||
Intents,
|
||||
Client as DiscordClient
|
||||
} from "discord.js";
|
||||
import { existsSync, readdirSync } from "fs";
|
||||
import path from "path";
|
||||
@@ -22,9 +21,9 @@ export default class Client extends DiscordClient {
|
||||
public constructor() {
|
||||
super({
|
||||
intents: [
|
||||
Intents.FLAGS.GUILDS,
|
||||
Intents.FLAGS.GUILD_MESSAGES,
|
||||
Intents.FLAGS.GUILD_VOICE_STATES,
|
||||
"Guilds",
|
||||
"GuildMessages",
|
||||
"GuildVoiceStates",
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { MessageEmbed } from "discord.js";
|
||||
import Player from "./Player";
|
||||
import { loopOption, track } from "./Types";
|
||||
import { loopMoji, secToISO, statusBarGenerator, volumeMoji } from "./Misc";
|
||||
import Queue from "./Queue";
|
||||
import { AudioResource } from "@discordjs/voice";
|
||||
import { EmbedBuilder } from "discord.js";
|
||||
|
||||
export default class I8n {
|
||||
export default class I18n {
|
||||
public static en = {
|
||||
nowPlaying: (track: track) => {
|
||||
return new MessageEmbed()
|
||||
.setColor("LUMINOUS_VIVID_PINK")
|
||||
return new EmbedBuilder()
|
||||
.setColor("LuminousVividPink")
|
||||
.setAuthor({
|
||||
iconURL: track.requester.avatarURL() || undefined,
|
||||
name: track.requester.tag,
|
||||
@@ -20,42 +20,42 @@ export default class I8n {
|
||||
.setThumbnail(track.thumbnail);
|
||||
},
|
||||
cleared: (amount: number) => {
|
||||
return new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle(
|
||||
`**♻️ ${amount} tracks have been cleared from the queue.**`
|
||||
)
|
||||
.setTimestamp(new Date());
|
||||
},
|
||||
okConnected: (channel: string) => {
|
||||
return new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle(`**✅ Successfuly connected to:** _${channel}_.`);
|
||||
},
|
||||
notConnected: () => {
|
||||
return new MessageEmbed()
|
||||
.setColor("RED")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Red")
|
||||
.setTitle(
|
||||
"**🚫 Make yourself connected to a voice channel beforehand.**"
|
||||
);
|
||||
},
|
||||
wasConnected: () => {
|
||||
return new MessageEmbed()
|
||||
.setColor("YELLOW")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Yellow")
|
||||
.setTitle("**⚠️ Already connected to a voice channel.**");
|
||||
},
|
||||
filtered: (filter?: string) => {
|
||||
return new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle(filter ? `**✅ ${filter} was applied to the player.**` : "**✅ All filters were declined.**");
|
||||
},
|
||||
appended: (track?: track) => {
|
||||
return !track
|
||||
? new MessageEmbed()
|
||||
.setColor("RED")
|
||||
? new EmbedBuilder()
|
||||
.setColor("Red")
|
||||
.setTitle("**🚫 Could not add track to the queue.**")
|
||||
: new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
: new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle(track.title)
|
||||
.setURL(track.url)
|
||||
.setThumbnail(track.thumbnail)
|
||||
@@ -68,69 +68,69 @@ export default class I8n {
|
||||
},
|
||||
jumped: (state: boolean) => {
|
||||
return state
|
||||
? new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
? new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle("_**Perfoming jump.**_")
|
||||
: new MessageEmbed()
|
||||
.setColor("RED")
|
||||
: new EmbedBuilder()
|
||||
.setColor("Red")
|
||||
.setTitle("**❗ Bad _jump_ request.**");
|
||||
},
|
||||
looped: (query: loopOption) => {
|
||||
switch (query) {
|
||||
case "AUTO": {
|
||||
return new MessageEmbed()
|
||||
.setColor("LUMINOUS_VIVID_PINK")
|
||||
return new EmbedBuilder()
|
||||
.setColor("LuminousVividPink")
|
||||
.setTitle(
|
||||
"**🔀 Shuffle mode** _(does not affect the queue order)_."
|
||||
);
|
||||
}
|
||||
case "LOOP": {
|
||||
return new MessageEmbed()
|
||||
.setColor("BLUE")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Blue")
|
||||
.setTitle("**🔁 Looping over the queue.**");
|
||||
}
|
||||
case "NONE": {
|
||||
return new MessageEmbed()
|
||||
.setColor("RED")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Red")
|
||||
.setTitle("**⤵️ Player will stop on the queue end.**");
|
||||
}
|
||||
case "SONG": {
|
||||
return new MessageEmbed()
|
||||
.setColor("YELLOW")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Yellow")
|
||||
.setTitle("**🔂 Looping a single track.**");
|
||||
}
|
||||
}
|
||||
},
|
||||
skipped: () => {
|
||||
return new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle("**⏭️ Skipping.**");
|
||||
},
|
||||
paused: (state: boolean) => {
|
||||
return state
|
||||
? new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
? new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle("_**▶️ Resumed.**_")
|
||||
: new MessageEmbed()
|
||||
.setColor("YELLOW")
|
||||
: new EmbedBuilder()
|
||||
.setColor("Yellow")
|
||||
.setTitle("_**⏸️ Paused.**_");
|
||||
},
|
||||
removed: (track?: track) => {
|
||||
return track
|
||||
? new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
? new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle(track.title)
|
||||
.setDescription("**was removed from the queue.**")
|
||||
.setTimestamp(new Date())
|
||||
.setURL(track.url)
|
||||
.setThumbnail(track.thumbnail)
|
||||
: new MessageEmbed()
|
||||
.setColor("RED")
|
||||
: new EmbedBuilder()
|
||||
.setColor("Red")
|
||||
.setTitle("**❗ Bad _remove_ request.**");
|
||||
},
|
||||
fastForwarded: (amount: number) => {
|
||||
return new MessageEmbed()
|
||||
.setColor("BLUE")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Blue")
|
||||
.setTitle(
|
||||
`**⏩ Fast-forwarding to ${secToISO(
|
||||
amount
|
||||
@@ -138,29 +138,29 @@ export default class I8n {
|
||||
);
|
||||
},
|
||||
destroyed: () => {
|
||||
return new MessageEmbed()
|
||||
.setColor("RED")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Red")
|
||||
.setTitle("**💀 Destroying the player.**");
|
||||
},
|
||||
volumeSet: (amount: number) => {
|
||||
return new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle(`**${volumeMoji(amount)} Volume has been set to ${amount}%**`);
|
||||
},
|
||||
queueEmpty: () => {
|
||||
return new MessageEmbed()
|
||||
.setColor("YELLOW")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Yellow")
|
||||
.setTitle("**❎ Queue is empty.**");
|
||||
},
|
||||
playerInfo: (player?: Player) => {
|
||||
if (!player)
|
||||
return new MessageEmbed()
|
||||
.setColor("RED")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Red")
|
||||
.setTitle("**🚫 Player does not exist.**");
|
||||
|
||||
if (player.Resource) {
|
||||
return new MessageEmbed()
|
||||
.setColor("LUMINOUS_VIVID_PINK")
|
||||
return new EmbedBuilder()
|
||||
.setColor("LuminousVividPink")
|
||||
.setTitle(
|
||||
`${player.Queue.Position + 1}. ${player.Resource.metadata.title}`
|
||||
)
|
||||
@@ -208,8 +208,8 @@ export default class I8n {
|
||||
},
|
||||
]);
|
||||
} else {
|
||||
return new MessageEmbed()
|
||||
.setColor("BLUE")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Blue")
|
||||
.setTitle("💿 Insert the disk...")
|
||||
.setDescription(statusBarGenerator(0, 0))
|
||||
.setURL(
|
||||
@@ -262,8 +262,8 @@ export default class I8n {
|
||||
Math.min(Math.floor(queue.Tracks.length / 11), page)
|
||||
);
|
||||
|
||||
return new MessageEmbed()
|
||||
.setColor("LUMINOUS_VIVID_PINK")
|
||||
return new EmbedBuilder()
|
||||
.setColor("LuminousVividPink")
|
||||
.setTitle(
|
||||
resource
|
||||
? `${queue.Position + 1}. ${resource.metadata.title}`
|
||||
@@ -301,29 +301,18 @@ export default class I8n {
|
||||
);
|
||||
},
|
||||
fullyAlone: () => {
|
||||
return new MessageEmbed()
|
||||
.setColor("LUMINOUS_VIVID_PINK")
|
||||
return new EmbedBuilder()
|
||||
.setColor("LuminousVividPink")
|
||||
.setTitle("🥬 I have decided to leave to conserve my energy.")
|
||||
.setDescription(
|
||||
"_**Since there was nobody in the voice channel.**_"
|
||||
);
|
||||
},
|
||||
reshuffle: () => {
|
||||
return new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Green")
|
||||
.setTitle("**✅ Successfuly reshuffled queue.**");
|
||||
},
|
||||
savedQueue: (title: string) => {
|
||||
return new MessageEmbed()
|
||||
.setColor("GREEN")
|
||||
.setTitle(`**✅ Successfuly saved ${title} to the server's storage.**`);
|
||||
},
|
||||
savedExceed: (title: string) => {
|
||||
return new MessageEmbed()
|
||||
.setColor("RED")
|
||||
.setTitle(`**🚫 Could not save ${title} to the storage.**`)
|
||||
.setDescription("_**Delete your old one beforehand...**_");
|
||||
},
|
||||
ping: (ping?: number) => {
|
||||
const title = ping ? `I have pinged ${ping} ms late.` : "There is no application.";
|
||||
|
||||
@@ -331,8 +320,8 @@ export default class I8n {
|
||||
ping > 200 ? "I can do better than this." :
|
||||
"Dream's speed!";
|
||||
|
||||
return new MessageEmbed()
|
||||
.setColor("RANDOM")
|
||||
return new EmbedBuilder()
|
||||
.setColor("Random")
|
||||
.setTitle(`**${title}**`)
|
||||
.setDescription(`_**${comment}**_`);
|
||||
}
|
||||
+2
-2
@@ -23,7 +23,7 @@ import Music from "./Music";
|
||||
import Filter from "./Filter";
|
||||
import Queue from "./Queue";
|
||||
import { fetchStream } from "./Fetch";
|
||||
import I8n from "./I8n";
|
||||
import I18n from "./I18n";
|
||||
|
||||
import ytdl from "discord-ytdl-core";
|
||||
import { track } from "./Types";
|
||||
@@ -136,7 +136,7 @@ export default class Player {
|
||||
if (this.message) await this.message.delete();
|
||||
|
||||
this.message = await this.channel.send({
|
||||
embeds: [I8n.en.nowPlaying(track)],
|
||||
embeds: [I18n.en.nowPlaying(track)],
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+13
-15
@@ -1,21 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "src",
|
||||
"module": "CommonJS",
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"target": "ESNext",
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "Node",
|
||||
"lib": [ "ESNext" ],
|
||||
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "dist",
|
||||
"removeComments": false,
|
||||
"sourceMap": true,
|
||||
"types": [ "node" ]
|
||||
"esModuleInterop": true,
|
||||
|
||||
"target": "ESNext",
|
||||
"lib": ["ESNext"],
|
||||
"types": ["node"],
|
||||
"skipLibCheck": true
|
||||
},
|
||||
"include": [
|
||||
"src/**/*"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"dist"
|
||||
]
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
Reference in new issue
Block a user