diff --git a/src/commands/info/About.ts b/src/commands/info/About.ts new file mode 100644 index 000000000..4ae7dda35 --- /dev/null +++ b/src/commands/info/About.ts @@ -0,0 +1,67 @@ +import { Command, Lavamusic, Context } from "../../structures/index.js"; +import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"; + + +export default class About extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "about", + description: { + content: "Shows information about the bot", + examples: ["about"], + usage: "about" + }, + category: "info", + aliases: ["ab"], + cooldown: 3, + args: false, + player: { + voice: false, + dj: false, + active: false, + djPerm: null + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [] + }, + slashCommand: true, + options: [] + }); + }; + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + + const row = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setLabel("Invite Lavamusic") + .setStyle(ButtonStyle.Link) + .setURL(`https://discord.com/api/oauth2/authorize?client_id=875635121770889257&permissions=8&scope=bot%20applications.commands`), + new ButtonBuilder() + .setLabel("Support Server") + .setStyle(ButtonStyle.Link) + .setURL("https://discord.gg/ns8CTk9J3e")) + + const embed = this.client.embed() + .setAuthor({ name: 'LavaMusic', iconURL: 'https://media.discordapp.net/attachments/876035356460462090/888434725235097610/20210820_124325.png' }) + .setThumbnail('https://media.discordapp.net/attachments/876035356460462090/888434725235097610/20210820_124325.png') + .setColor(this.client.color.main) + .addFields([ + { name: 'Creator', value: '[Blacky#9125](https://github.com/brblacky)', inline: true }, + { name: 'Repository', value: '[Here](https://github.com/brblacky/lavamusic)', inline: true }, + { name: 'Support', value: '[Here](https://discord.gg/ns8CTk9J3e)', inline: true }, + { name: '\u200b', value: `He really wanted to make his first open source project ever for more coding experience. In this project, he was challenged to make a project with less bugs. Hope you enjoy using LavaMusic!`, inline: true }, + ]); + return await ctx.sendMessage({ content: '', embeds: [embed], components: [row] }); + } +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/info/Help.ts b/src/commands/info/Help.ts index 7baec1e0b..e14571574 100644 --- a/src/commands/info/Help.ts +++ b/src/commands/info/Help.ts @@ -90,4 +90,15 @@ export default class Help extends Command { ctx.sendMessage({ embeds: [helpEmbed] }); }; }; -} \ No newline at end of file +} + + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/info/Info.ts b/src/commands/info/Info.ts new file mode 100644 index 000000000..d9c03d92f --- /dev/null +++ b/src/commands/info/Info.ts @@ -0,0 +1,75 @@ +import { Command, Lavamusic, Context } from "../../structures/index.js"; +import os from "os"; +import { version } from "discord.js"; + +export default class Info extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "info", + description: { + content: "Ingormation about the bot", + examples: ["info"], + usage: "info" + }, + category: "info", + aliases: ["botinfo", "bi"], + cooldown: 3, + args: false, + player: { + voice: false, + dj: false, + active: false, + djPerm: null + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [] + }, + slashCommand: true, + options: [] + }); + }; + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + const osType = os.type(); + const osRelease = os.release(); + const osUptime = os.uptime(); + const osHostname = os.hostname(); + const cpuArch = os.arch(); + const cpuCores = os.cpus().length; + const totalMem = os.totalmem(); + const freeMem = os.freemem(); + const usedMem = totalMem - freeMem; + const nodeVersion = process.version; + const discordJsVersion = version; + const botGuilds = client.guilds.cache.size; + const botChannels = client.channels.cache.size; + const botUsers = client.users.cache.size; + const botCommands = client.commands.size; + + const botInfo = `Bot Information: +- **Operating System**: ${osType} ${osRelease} +- **Uptime**: ${client.utils.formatTime(osUptime)} +- **Hostname**: ${osHostname} +- **CPU Architecture**: ${cpuArch} (${cpuCores} cores) +- **Memory Usage**: ${client.utils.formatBytes(usedMem)} / ${client.utils.formatBytes(totalMem)} (${Math.round((usedMem / totalMem) * 100)}%) +- **Node.js Version**: ${nodeVersion} +- **Discord.js Version**: ${discordJsVersion} +- **Connected to** ${botGuilds} guilds, ${botChannels} channels, and ${botUsers} users +- **Total Commands**: ${botCommands} + `; + + const embed = this.client.embed(); + return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(botInfo)] }); + } +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/info/Invite.ts b/src/commands/info/Invite.ts new file mode 100644 index 000000000..23db37e35 --- /dev/null +++ b/src/commands/info/Invite.ts @@ -0,0 +1,57 @@ +import { Command, Lavamusic, Context } from "../../structures/index.js"; +import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js"; + +export default class Invite extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "invite", + description: { + content: "Sends the bot's invite link", + examples: ["invite"], + usage: "invite" + }, + category: "info", + aliases: ["inv"], + cooldown: 3, + args: false, + player: { + voice: false, + dj: false, + active: false, + djPerm: null + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [] + }, + slashCommand: true, + options: [] + }); + }; + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + + const embed = this.client.embed(); + const row = new ActionRowBuilder().addComponents( + new ButtonBuilder() + .setLabel("Invite Lavamusic") + .setStyle(ButtonStyle.Link) + .setURL(`https://discord.com/api/oauth2/authorize?client_id=875635121770889257&permissions=8&scope=bot%20applications.commands`), + new ButtonBuilder() + .setLabel("Support Server") + .setStyle(ButtonStyle.Link) + .setURL("https://discord.gg/ns8CTk9J3e")) + + return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(`[Invite Lavamusic](https://discord.com/api/oauth2/authorize?client_id=875635121770889257&permissions=8&scope=bot%20applications.commands) | [Support Server](https://discord.gg/ns8CTk9J3e)`)], components: [row] }); + } +}; + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/moderator/AddRole.ts b/src/commands/moderator/AddRole.ts new file mode 100644 index 000000000..14217fd0b --- /dev/null +++ b/src/commands/moderator/AddRole.ts @@ -0,0 +1,37 @@ +import { Command, Lavamusic, Context } from "../../structures/index.js"; + + +export default class AddRole extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "addrole", + description: { + content: "Adds a role to a user", + examples: ["addrole @user @role"], + usage: "addrole " + }, + category: "moderator", + aliases: ["ar"], + cooldown: 3, + args: true, + player: { + voice: false, + dj: false, + active: false, + djPerm: null + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks", "ManageRoles"], + user: ["ManageRoles"] + }, + slashCommand: false, + options: [] + }); + }; + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + + const embed = this.client.embed(); + + } +} \ No newline at end of file diff --git a/src/commands/music/ClearQueue.ts b/src/commands/music/ClearQueue.ts index 8506c11d0..ca8f51888 100644 --- a/src/commands/music/ClearQueue.ts +++ b/src/commands/music/ClearQueue.ts @@ -38,4 +38,14 @@ export default class ClearQueue extends Command { return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(`Cleared the queue`)] }); } -} \ No newline at end of file +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Join.ts b/src/commands/music/Join.ts index b168d36e0..7ac37cdc1 100644 --- a/src/commands/music/Join.ts +++ b/src/commands/music/Join.ts @@ -40,4 +40,14 @@ export default class Join extends Command { return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(`I'm already connected to <#${player.player.connection.channelId}>`)] }); } } -} \ No newline at end of file +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Leave.ts b/src/commands/music/Leave.ts index d9a2ab69f..ee3b3129c 100644 --- a/src/commands/music/Leave.ts +++ b/src/commands/music/Leave.ts @@ -11,7 +11,7 @@ export default class Leave extends Command { usage: "leave" }, category: "music", - aliases: ["l"], + aliases: ["dc"], cooldown: 3, args: false, player: { @@ -37,4 +37,14 @@ export default class Leave extends Command { ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(`Left <#${player.player.connection.channelId}>`)] }); player.destroy(); } -} \ No newline at end of file +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Nowplaying.ts b/src/commands/music/Nowplaying.ts index a91ff9b8c..168bcbf11 100644 --- a/src/commands/music/Nowplaying.ts +++ b/src/commands/music/Nowplaying.ts @@ -49,4 +49,14 @@ export default class Nowplaying extends Command { return ctx.sendMessage({ embeds: [embed1] }); } -} \ No newline at end of file +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Pause.ts b/src/commands/music/Pause.ts new file mode 100644 index 000000000..d12cf0d92 --- /dev/null +++ b/src/commands/music/Pause.ts @@ -0,0 +1,53 @@ +import { Lavamusic, Context, Command } from "../../structures/index.js"; + + +export default class Pause extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "pause", + description: { + content: "Pauses the current song", + examples: ["pause"], + usage: "pause" + }, + category: "music", + aliases: [], + cooldown: 3, + args: false, + player: { + voice: true, + dj: false, + active: true, + djPerm: null + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [] + }, + slashCommand: true, + options: [] + }); + }; + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (!player.paused) { + player.pause(); + return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(`Paused the song`)] }); + } else { + return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.red).setDescription(`The song is already paused`)] }); + } + } +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Play.ts b/src/commands/music/Play.ts index 55af0c57c..c9f49213c 100644 --- a/src/commands/music/Play.ts +++ b/src/commands/music/Play.ts @@ -75,4 +75,15 @@ export default class Play extends Command { } } -}; \ No newline at end of file +}; + + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Queue.ts b/src/commands/music/Queue.ts index f8802cda8..03b2165de 100644 --- a/src/commands/music/Queue.ts +++ b/src/commands/music/Queue.ts @@ -50,4 +50,14 @@ export default class Queue extends Command { return client.utils.paginate(ctx, pages); } -} \ No newline at end of file +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Remove.ts b/src/commands/music/Remove.ts new file mode 100644 index 000000000..f564fe6db --- /dev/null +++ b/src/commands/music/Remove.ts @@ -0,0 +1,60 @@ +import { Command, Lavamusic, Context } from "../../structures/index.js"; + + +export default class Remove extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "remove", + description: { + content: "Removes a song from the queue", + examples: ["remove 1"], + usage: "remove " + }, + category: "music", + aliases: ["rm"], + cooldown: 3, + args: true, + player: { + voice: true, + dj: false, + active: true, + djPerm: null + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [] + }, + slashCommand: true, + options: [ + { + name: "song", + description: "The song number", + type: 4, + required: true + } + ] + }); + }; + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (!player.queue.length) return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.red).setDescription("There are no songs in the queue.")] }); + if (isNaN(Number(args[0]))) return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.red).setDescription("That is not a valid number.")] }); + if (Number(args[0]) > player.queue.length) return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.red).setDescription("That is not a valid number.")] }); + if (Number(args[0]) < 1) return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.red).setDescription("That is not a valid number.")] }); + player.remove(Number(args[0]) - 1); + return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(`Removed song number ${Number(args[0])} from the queue`)] }); + } +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Resume.ts b/src/commands/music/Resume.ts new file mode 100644 index 000000000..5ba65020d --- /dev/null +++ b/src/commands/music/Resume.ts @@ -0,0 +1,51 @@ +import { Command, Lavamusic, Context } from "../../structures/index.js"; + + +export default class Resume extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "resume", + description: { + content: "Resumes the current song", + examples: ["resume"], + usage: "resume" + }, + category: "music", + aliases: ["r"], + cooldown: 3, + args: false, + player: { + voice: true, + dj: false, + active: true, + djPerm: null + }, + permissions: { + dev: false, + client: ["SendMessages", "ViewChannel", "EmbedLinks"], + user: [] + }, + slashCommand: true, + options: [] + }); + }; + public async run(client: Lavamusic, ctx: Context, args: string[]): Promise { + + const player = client.queue.get(ctx.guild.id); + const embed = this.client.embed(); + if (!player.paused) return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.red).setDescription("The player is not paused.")] }); + player.pause(); + + return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(`Resumed the player`)] }); + } +} + +/** + * Project: lavamusic + * Author: Blacky + * Company: Coders + * Copyright (c) 2023. All rights reserved. + * This code is the property of Coder and may not be reproduced or + * modified without permission. For more information, contact us at + * https://discord.gg/ns8CTk9J3e + */ \ No newline at end of file diff --git a/src/commands/music/Seek.ts b/src/commands/music/Seek.ts new file mode 100644 index 000000000..c3bca2254 --- /dev/null +++ b/src/commands/music/Seek.ts @@ -0,0 +1,53 @@ +import { Command, Lavamusic, Context } from "../../structures/index.js"; + + +export default class Seek extends Command { + constructor(client: Lavamusic) { + super(client, { + name: "seek", + description: { + content: "Seeks to a certain time in the song", + examples: ["seek 1m, seek 1h 30m"], + usage: "seek