`
-]
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- if (ctx.guild === null)
- return;
-
- const player = (client.Modules["music"].control as Music).getPlayer(ctx.guild.id);
-
- if (!player || !player.NowPlaying)
- return;
-
- await ctx.deferReply();
-
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(player.NowPlaying.metadata.title)
- .setDescription("Lyrics powered by Google and their partners.");
-
- const response = await fetch(`https://www.google.com/search?q=${player.NowPlaying.metadata.title.replace(" ", "+").replace(/ *\[[^)]*\] */g, "") + "+Lyrics"}`)
- const data = await response.text();
-
- if (!data.includes(dividers[0])) {
- embed.setTitle("Could not find lyrics for that one.");
- ctx.editReply({ embeds: [embed] });
- return;
- }
-
-
- await ctx.editReply({ content: `\`\`\`\n${data.split(dividers[0])[1].split(dividers[1])[0]}\`\`\``, embeds: [embed]});
-}
-
-const data = {
- name: "lyrics",
- description: "Get lyrics for current song.",
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/next.ts b/src/modules/music/commands/next.ts
deleted file mode 100644
index a95ddcf..0000000
--- a/src/modules/music/commands/next.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- if (ctx.guild === null)
- return;
-
-
- const player = client.Modules["music"].control.getPlayer(ctx.guild.id);
-
- if (player) {
- player.skip();
-
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle("Skipped.");
-
- await ctx.reply({ embeds: [embed] });
- }
-}
-
-const data = {
- name: "next",
- description: "Skip current song."
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/pause.ts b/src/modules/music/commands/pause.ts
deleted file mode 100644
index 2540b20..0000000
--- a/src/modules/music/commands/pause.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- if (ctx.guild === null)
- return;
-
- const player = client.Modules["music"].control.getPlayer(ctx.guild.id);
-
- if (player) {
- const state = player.pause();
-
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`Player is now ${state ? "paused" : "resumed"}.`);
-
- await ctx.reply({ embeds: [embed] });
- }
-}
-
-const data = {
- name: "pause",
- description: "Toggle pause.",
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/peak.ts b/src/modules/music/commands/peak.ts
deleted file mode 100644
index dda4ce5..0000000
--- a/src/modules/music/commands/peak.ts
+++ /dev/null
@@ -1,33 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-import { QueueStorage } from "../assets/QuetzaMusic/QueueStorage";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- if (ctx.guild === null)
- return;
-
- await ctx.deferReply();
-
- const data = new QueueStorage(`./data/queues/${ctx.guild.id}.json`);
-
- let embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`${ctx.guild.name} queues:`);
-
- data.Data.forEach((entry, title) => {
- embed.addField(title, entry.description);
- });
-
- await ctx.editReply({ embeds: [embed] });
-}
-
-const data = {
- name: "peak",
- description: "Peak at guild storage."
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/play.ts b/src/modules/music/commands/play.ts
deleted file mode 100644
index 27dc77b..0000000
--- a/src/modules/music/commands/play.ts
+++ /dev/null
@@ -1,66 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-import { run as connect } from "./connect";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- const query = ctx.options.getString("query");
-
- const player = await connect(client, ctx, false);
-
- if (!player)
- return;
-
- await ctx.deferReply();
-
- let embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle("Now playing.")
- .setAuthor({ name:`@${ctx.user.tag}`, iconURL: ctx.user.avatarURL() as string });
-
- if (query) {
- const track = await player.addTrack(query, ctx.user);
-
- if (!track) {
- embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle("Cannot append the track or playlist.")
- .setAuthor({ name: `@${ctx.user.tag}`, iconURL: ctx.user.avatarURL() as string });
- }
- else {
- embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(track.title)
- .setDescription("Has been pushed to queue.")
- .setURL(track.url)
- .setThumbnail(track.thumbnail)
- .setAuthor({ name: `@${ctx.user.tag}`, iconURL: ctx.user.avatarURL() as string });
- console.log(`${track.title} added to ${ctx.guildId}`);
- }
-
- }
-
- await ctx.editReply({ embeds: [embed] });
-
- if (!player.NowPlaying) {
- await player.play();
- }
-}
-
-const data = {
- name: "play",
- description: "Play a song or add it to queue.",
- options: [
- {
- name: "query",
- description: "Title or URL of the song.",
- type: "STRING",
- required: true
- }
- ]
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/queue.ts b/src/modules/music/commands/queue.ts
deleted file mode 100644
index f20976b..0000000
--- a/src/modules/music/commands/queue.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import {
- ButtonInteraction, ColorResolvable,
- CommandInteraction, Message, MessageActionRow,
- MessageButton, MessageEmbed
-} from "discord.js";
-
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-import { queueDesigner } from "../assets/Misc"
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- if (ctx.guild === null)
- return;
-
- const player = client.Modules["music"].control.getPlayer(ctx.guild.id);
-
- if (!player)
- return;
-
- await ctx.deferReply();
- const queue = player.Queue;
-
- if (queue.length === 0) {
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle("Queue is empty.");
-
- await ctx.editReply({ embeds: [embed] });
- return;
- }
-
- let page = 0;
- const maxPage = Math.floor(queue.length / 11);
-
- const row = new MessageActionRow()
- .addComponents(
- new MessageButton()
- .setCustomId("QueueTop")
- .setLabel("TOP")
- .setStyle("SECONDARY"),
- new MessageButton()
- .setCustomId("QueueUp")
- .setLabel("UP")
- .setStyle("SECONDARY"),
- new MessageButton()
- .setCustomId("QueueDown")
- .setLabel("DOWN")
- .setStyle("SECONDARY"),
- new MessageButton()
- .setCustomId("QueueEnd")
- .setLabel("END")
- .setStyle("SECONDARY")
- );
-
- const message = await ctx.editReply({
- embeds: [ queueDesigner(queue, page, player.NowPlaying, player.NowPlayingPos) ],
- components: [row]
- }) as Message;
-
- const collector = message.createMessageComponentCollector({ time: 15000 });
-
- collector.on("collect", async (btn: ButtonInteraction) => {
- console.log(page);
- switch (btn.customId) {
- case "QueueTop": { page = 0; break; }
- case "QueueUp": { page = Math.max(page - 1, 0); break; }
- case "QueueDown": { page = Math.min(page + 1, maxPage); break; }
- case "QueueEnd": page = maxPage;
- }
-
- await btn.update({
- embeds: [ queueDesigner(queue, page, player.NowPlaying, player.NowPlayingPos) ]
- });
- });
-}
-
-const data = {
- name: "queue",
- description: "Send player queue.",
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/remove.ts b/src/modules/music/commands/remove.ts
deleted file mode 100644
index 737cd0b..0000000
--- a/src/modules/music/commands/remove.ts
+++ /dev/null
@@ -1,56 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- const query = ctx.options.getString("position");
-
- if (ctx.guild === null || query === null)
- return;
-
-
- let player = client.Modules["music"].control.getPlayer(ctx.guild.id);
-
- if (!player)
- return;
-
- await ctx.deferReply();
-
- let state: boolean;
-
- if (!isNaN(Number(query))) {
- state = await player.remove(Number(query) - 1);
- } else {
- state = await player.remove(query);
- }
-
- let embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle("Could not find track specified.");
-
- if (state) {
- embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle("Removed.");
- }
-
- await ctx.editReply({ embeds: [embed] });
-}
-
-const data = {
- name: "remove",
- description: "Remove specific track in queue.",
- options: [
- {
- name: "position",
- description: "Position to remove.",
- type: "STRING",
- required: true
- }
- ]
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/save.ts b/src/modules/music/commands/save.ts
deleted file mode 100644
index 7eeda07..0000000
--- a/src/modules/music/commands/save.ts
+++ /dev/null
@@ -1,84 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-import { QueueStorage } from "../assets/QuetzaMusic/QueueStorage";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- const title = ctx.options.getString("title");
- const description = ctx.options.getString("description");
-
- if (ctx.guild === null || title === null || description === null)
- return;
-
-
- let player = client.Modules["music"].control.getPlayer(ctx.guild.id);
-
- if (!player)
- return;
-
- await ctx.deferReply();
-
- if (player.Queue.length !== 0) {
- const data = new QueueStorage(`./data/queues/${ctx.guild.id}.json`);
-
- const slot = data.getEntry(title);
-
- if (slot) {
- if (slot.owner === ctx.user.id) {
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`Aww... ${title} already exists. Delete it first before saving a new one.`);
- await ctx.editReply({ embeds: [embed] });
- return;
- }
- else {
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`Sorry, but ${title} save is not yours. You can not do that.`);
- await ctx.editReply({ embeds: [embed] });
- return;
- }
- }
-
- data.createEntry(player.Queue, title, description, ctx.user.id);
- data.saveData(`./data/queues/${ctx.guild.id}.json`)
-
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`I will create new save entry ${title}`);
-
- await ctx.editReply({ embeds: [embed] });
- }
- else {
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`Looks like an issue. Make sure you are doing it well`);
-
- await ctx.editReply({ embeds: [embed] });
- }
-
-}
-
-const data = {
- name: "save",
- description: "Save queue to guild storage.",
- options: [
- {
- name: "title",
- description: "Save slot title.",
- type: "STRING",
- required: true
- },
- {
- name: "description",
- description: "Save slot description.",
- type: "STRING",
- required: true
- }
- ]
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/seek.ts b/src/modules/music/commands/seek.ts
deleted file mode 100644
index 9726cb5..0000000
--- a/src/modules/music/commands/seek.ts
+++ /dev/null
@@ -1,58 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- const hours = ctx.options.getInteger("hrs") as number;
- const minutes = ctx.options.getInteger("mins") as number;
- const seconds = ctx.options.getInteger("secs") as number;
-
- if (ctx.guild === null)
- return;
-
- const time = hours * 3600 + minutes * 60 + seconds;
-
- let player = client.Modules["music"].control.getPlayer(ctx.guild.id);
-
- if (player) {
- await ctx.deferReply();
-
- await player.seek(time);
-
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`Fastforwarded to ${hours}:${minutes}.${seconds}.`);
-
- await ctx.editReply({ embeds: [embed] });
- }
-}
-
-const data = {
- name: "seek",
- description: "Fastforward to timecode.",
- options: [
- {
- name: "hrs",
- description: "Hour to seek.",
- type: "INTEGER",
- required: false
- },
- {
- name: "mins",
- description: "Minute to seek.",
- type: "INTEGER",
- required: false
- },
- {
- name: "secs",
- description: "Second to seek.",
- type: "INTEGER",
- required: false
- }
- ]
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/stop.ts b/src/modules/music/commands/stop.ts
deleted file mode 100644
index 526cd8b..0000000
--- a/src/modules/music/commands/stop.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- if (ctx.guild === null)
- return;
-
- const player = client.Modules["music"].control.getPlayer(ctx.guild.id);
-
- if (player) {
- player.destroy();
-
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`Player is now destroyed.`);
-
- await ctx.reply({ embeds: [embed] });
- }
-}
-
-const data = {
- name: "stop",
- description: "Destroys player.",
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/commands/volume.ts b/src/modules/music/commands/volume.ts
deleted file mode 100644
index 8ba43ed..0000000
--- a/src/modules/music/commands/volume.ts
+++ /dev/null
@@ -1,48 +0,0 @@
-import { quetzaConfig } from "../../../config";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- const volume = ctx.options.getInteger("volume");
-
- if (ctx.guild === null || volume === null)
- return;
-
-
- let player = client.Modules["music"].control.getPlayer(ctx.guild.id);
-
- if (!player)
- return;
-
- await ctx.deferReply();
-
- let embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`Error occured while setting the volume.`);
-
- if (player.volume(volume)) {
- embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle(`Volume has been set to ${volume / 100}.`);
- }
-
- await ctx.editReply({ embeds: [embed] });
-}
-
-const data = {
- name: "volume",
- description: "Set music volume.",
- options: [
- {
- name: "volume",
- description: "Volume to switch to in percents.",
- type: "INTEGER",
- required: true
- }
- ]
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/music/events/voiceStateUpdate.ts b/src/modules/music/events/voiceStateUpdate.ts
deleted file mode 100644
index 3e6988c..0000000
--- a/src/modules/music/events/voiceStateUpdate.ts
+++ /dev/null
@@ -1,29 +0,0 @@
-import { ColorResolvable, MessageEmbed, VoiceState } from "discord.js";
-import { quetzaConfig } from "../../../config";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-import { asleep } from "../assets/Misc";
-
-export async function run(client: QuetzaClient, args: VoiceState[]): Promise {
- const [oldState, newState] = args;
-
- const player = client.Modules["music"].control.getPlayer(newState.guild.id);
-
- if (!player)
- return;
-
- if (oldState.channel?.members.size === 1 && oldState.channel.members.first()?.id === client.user?.id) {
- await asleep(30000);
- const channel = player.Channel;
- if (oldState.channel.members.size === 1) {
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle("I've decided to leave to conserve my energy")
- .setDescription("Since there was nobody in the voice channel.")
- await channel.send({ embeds: [embed] });
- player.destroy();
- }
- }
-}
-
-
-export const name = "voiceStateUpdate";
\ No newline at end of file
diff --git a/src/modules/music/qmodule.ts b/src/modules/music/qmodule.ts
deleted file mode 100644
index 5e3c5a0..0000000
--- a/src/modules/music/qmodule.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { Music } from "./assets/QuetzaMusic/Music";
-
-const data = {
- key: "music",
- name: "QuetzaMusic",
- description: "Quetza music module v.1.5.0",
- author: "unknowableshade"
-}
-
-const control = new Music();
-
-export {data, control};
\ No newline at end of file
diff --git a/src/modules/quetza/commands/modules.ts b/src/modules/quetza/commands/modules.ts
deleted file mode 100644
index 26dc4e2..0000000
--- a/src/modules/quetza/commands/modules.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import { quetzaConfig } from "../../../config";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-import { ColorResolvable, CommandInteraction, MessageEmbed } from "discord.js";
-
-
-
-
-export async function run(client: QuetzaClient, ctx: CommandInteraction) {
- await ctx.deferReply();
-
- const embed = new MessageEmbed()
- .setColor(quetzaConfig.color as ColorResolvable)
- .setTitle("Quetza applied modules:");
-
- for (const value of Object.values(client.Modules)) {
- embed.addField(
- value.data.name,
- `${value.data.description} (${value.data.author})`
- );
- }
-
- await ctx.editReply({ embeds: [embed] });
-}
-
-const data = {
- name: "modules",
- description: "Print out list of accessable modules."
-}
-
-export { data }
\ No newline at end of file
diff --git a/src/modules/quetza/events/interactionCreate.ts b/src/modules/quetza/events/interactionCreate.ts
deleted file mode 100644
index 90358b8..0000000
--- a/src/modules/quetza/events/interactionCreate.ts
+++ /dev/null
@@ -1,15 +0,0 @@
-import { Interaction } from "discord.js";
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-export async function run(client: QuetzaClient, args: Interaction[]): Promise {
- const [interaction] = args;
-
- if (interaction.isCommand()) {
- const command = client.Commands.get(interaction.commandName);
-
- if (command)
- command.run(client, interaction);
- }
-}
-
-export const name = "interactionCreate";
\ No newline at end of file
diff --git a/src/modules/quetza/events/ready.ts b/src/modules/quetza/events/ready.ts
deleted file mode 100644
index f054a0f..0000000
--- a/src/modules/quetza/events/ready.ts
+++ /dev/null
@@ -1,24 +0,0 @@
-import { QuetzaClient } from "../../../assets/QuetzaClient";
-
-export async function run(client: QuetzaClient, args: unknown[]): Promise {
- if (!client.user)
- return;
-
- Object.values(client.Modules).forEach((value) => {
- console.log(`Module ${value.data.name} is active...`);
- });
-
- console.log(`${client.user.username} logged in as ${client.user.tag}!`);
- client.user.setActivity("on sound waves.", { type: "PLAYING" });
-
- let restCommands = [];
-
- for (const value of client.Commands.values()) {
- restCommands.push(value.data);
- }
-
- client.application?.commands.set(restCommands);
-}
-
-
-export const name = "ready";
\ No newline at end of file
diff --git a/src/modules/quetza/qmodule.ts b/src/modules/quetza/qmodule.ts
deleted file mode 100644
index 48282e5..0000000
--- a/src/modules/quetza/qmodule.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-const data = {
- key: "quetza",
- name: "Quetza Main Frame",
- description: "Quetza default module v.1.5.0",
- author: "unknowableshade"
-}
-
-const control = undefined;
-
-export {data, control};
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 0efe6a0..3fa37d0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,12 +1,13 @@
{
"compilerOptions": {
+ "baseUrl": "src",
"module": "CommonJS",
"outDir": "./dist",
"strict": true,
"target": "ESNext",
"esModuleInterop": true,
"moduleResolution": "Node",
- "lib": [ "ESNext", "DOM" ],
+ "lib": [ "ESNext" ],
"sourceMap": true,
"types": [ "node" ]
},