Skip to content

Commit

Permalink
new
Browse files Browse the repository at this point in the history
  • Loading branch information
appujet committed Mar 6, 2023
1 parent 782de1e commit 2829942
Show file tree
Hide file tree
Showing 21 changed files with 658 additions and 12 deletions.
67 changes: 67 additions & 0 deletions src/commands/info/About.ts
Original file line number Diff line number Diff line change
@@ -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<void> {

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
*/
13 changes: 12 additions & 1 deletion src/commands/info/Help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,15 @@ export default class Help extends Command {
ctx.sendMessage({ embeds: [helpEmbed] });
};
};
}
}


/**
* 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
*/
75 changes: 75 additions & 0 deletions src/commands/info/Info.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
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
*/
57 changes: 57 additions & 0 deletions src/commands/info/Invite.ts
Original file line number Diff line number Diff line change
@@ -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<void> {

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
*/
37 changes: 37 additions & 0 deletions src/commands/moderator/AddRole.ts
Original file line number Diff line number Diff line change
@@ -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 <user> <role>"
},
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<void> {

const embed = this.client.embed();

}
}
12 changes: 11 additions & 1 deletion src/commands/music/ClearQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ export default class ClearQueue extends Command {

return ctx.sendMessage({ embeds: [embed.setColor(this.client.color.main).setDescription(`Cleared 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
*/
12 changes: 11 additions & 1 deletion src/commands/music/Join.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}>`)] });
}
}
}
}

/**
* 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
*/
14 changes: 12 additions & 2 deletions src/commands/music/Leave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default class Leave extends Command {
usage: "leave"
},
category: "music",
aliases: ["l"],
aliases: ["dc"],
cooldown: 3,
args: false,
player: {
Expand All @@ -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();
}
}
}

/**
* 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
*/
12 changes: 11 additions & 1 deletion src/commands/music/Nowplaying.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,14 @@ export default class Nowplaying extends Command {
return ctx.sendMessage({ embeds: [embed1] });

}
}
}

/**
* 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
*/
53 changes: 53 additions & 0 deletions src/commands/music/Pause.ts
Original file line number Diff line number Diff line change
@@ -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<void> {

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
*/
Loading

0 comments on commit 2829942

Please sign in to comment.