Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
- Update Mongoose Module & Others to Latest
- Added Filters Selection Menu to Player Message (by @devanshyadav2010

Note: Peoples are asking to update the source to Poru v5 but i dont update it. Why? Its not stable and still has some bugs on it. So, dont ask me to update it until its stable.
  • Loading branch information
adh319 committed Jan 31, 2024
1 parent a17b596 commit 978867f
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 20 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lunox",
"version": "2.3.0",
"description": "Lunox by @adh319#9370",
"version": "2.4.0",
"description": "Lunox by @adh319",
"main": "src/index.js",
"scripts": {
"start": "node ./src/index.js"
Expand All @@ -11,10 +11,10 @@
"delay": "^5.0.0",
"discord-hybrid-sharding": "^2.1.4",
"discord.js": "^14.14.1",
"dotenv": "^16.3.1",
"moment": "^2.29.4",
"dotenv": "^16.4.1",
"moment": "^2.30.1",
"moment-duration-format": "^2.3.2",
"mongoose": "^7.6.7",
"mongoose": "^8.1.1",
"node-capitalize": "^1.0.0",
"node-cron": "^3.0.3",
"node-fetch": "^2.7.0",
Expand Down
113 changes: 102 additions & 11 deletions src/events/poruEvents/player/trackStart.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require("discord.js");
const {
EmbedBuilder,
ActionRowBuilder,
ButtonBuilder,
ButtonStyle,
StringSelectMenuBuilder,
StringSelectMenuOptionBuilder,
} = require("discord.js");
const formatDuration = require("../../../structures/FormatDuration.js");
const Guild = require("../../../settings/models/Guild.js");
const capital = require("node-capitalize");
Expand Down Expand Up @@ -45,20 +52,51 @@ module.exports.run = async (client, player, track) => {
const bVUp = new ButtonBuilder().setCustomId("volup").setEmoji(emoji.volup).setStyle(ButtonStyle.Secondary);
const bInfo = new ButtonBuilder().setCustomId("info").setEmoji(emoji.info).setStyle(ButtonStyle.Secondary);

const filters = new StringSelectMenuBuilder()
.setCustomId("filters")
.setPlaceholder("Click Here To Apply Filters!")
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel("Clear Filters")
.setDescription("Click To Reset All Filter.")
.setValue("clear"),
new StringSelectMenuOptionBuilder()
.setLabel("8D Filter")
.setDescription("Click To Apply 8D Filter.")
.setValue("8d"),
new StringSelectMenuOptionBuilder()
.setLabel("Earrape Filter")
.setDescription("Click To Apply Earrape Filter.")
.setValue("earrape"),
new StringSelectMenuOptionBuilder()
.setLabel("Nightcore Filter")
.setDescription("Click To Apply Nightcore Filter.")
.setValue("nightcore"),
new StringSelectMenuOptionBuilder()
.setLabel("Slowmode Filter")
.setDescription("Click To Apply Slowmode Filter.")
.setValue("slowmode"),
new StringSelectMenuOptionBuilder()
.setLabel("Vaporwave Filter")
.setDescription("Click To Apply Vaporwave Filter.")
.setValue("vaporwave"),
);

const menu = new ActionRowBuilder().addComponents(filters);
const button = new ActionRowBuilder().addComponents(bReplay, bPrev, bPause, bSkip, bLoop);
const button2 = new ActionRowBuilder().addComponents(bShuffle, bVDown, bStop, bVUp, bInfo);

// When set to "disable", button control won't show.
if (Control === "disable") {
return client.channels.cache
.get(player.textChannel)
.send({ embeds: [Started] })
.send({ embeds: [Started], components: [] })
.then((x) => (player.message = x));
}

const nplaying = await client.channels.cache
.get(player.textChannel)
.send({ embeds: [Started], components: [button, button2] })
.send({ embeds: [Started], components: [menu, button, button2] })
.then((x) => (player.message = x));

const filter = (message) => {
Expand Down Expand Up @@ -90,7 +128,7 @@ module.exports.run = async (client, player, track) => {

bLoop.setEmoji(emoji.loop.track).setStyle(ButtonStyle.Primary);

await nplaying.edit({ embeds: [Started], components: [button, button2] });
await nplaying.edit({ embeds: [Started], components: [menu, button, button2] });
} else if (player.loop === "TRACK") {
message.deferUpdate();

Expand All @@ -102,7 +140,7 @@ module.exports.run = async (client, player, track) => {

bLoop.setEmoji(emoji.loop.queue).setStyle(ButtonStyle.Success);

await nplaying.edit({ embeds: [Started], components: [button, button2] });
await nplaying.edit({ embeds: [Started], components: [menu, button, button2] });
} else if (player.loop === "QUEUE") {
message.deferUpdate();

Expand All @@ -114,7 +152,7 @@ module.exports.run = async (client, player, track) => {

bLoop.setEmoji(emoji.loop.none).setStyle(ButtonStyle.Secondary);

await nplaying.edit({ embeds: [Started], components: [button, button2] });
await nplaying.edit({ embeds: [Started], components: [menu, button, button2] });
}
} else if (message.customId === "replay") {
if (!player) {
Expand Down Expand Up @@ -151,7 +189,7 @@ module.exports.run = async (client, player, track) => {

bPause.setEmoji(emoji.pause).setStyle(ButtonStyle.Secondary);

await nplaying.edit({ embeds: [Started], components: [button, button2] });
await nplaying.edit({ embeds: [Started], components: [menu, button, button2] });
} else {
message.deferUpdate();

Expand All @@ -164,12 +202,12 @@ module.exports.run = async (client, player, track) => {

bPause.setEmoji(emoji.resume).setStyle(ButtonStyle.Primary);

await nplaying.edit({ embeds: [Started], components: [button, button2] });
await nplaying.edit({ embeds: [Started], components: [menu, button, button2] });
}
} else if (message.customId === "skip") {
if (!player) {
collector.stop();
} else if (!player || player.queue.size == 0) {
} else if (player.queue.size == 0) {
const embed = new EmbedBuilder().setDescription(`\`❌\` | Queue is: \`Empty\``).setColor(client.color);

return message.reply({ embeds: [embed], ephemeral: true });
Expand Down Expand Up @@ -221,7 +259,7 @@ module.exports.run = async (client, player, track) => {
text: `Queue Left: ${player.queue.length} • Loop Mode: ${capital(player.loop)} • Volume: ${player.volume}%`,
});

await nplaying.edit({ embeds: [Started], components: [button, button2] });
await nplaying.edit({ embeds: [Started], components: [menu, button, button2] });
}
} else if (message.customId === "volup") {
if (!player) {
Expand All @@ -241,7 +279,7 @@ module.exports.run = async (client, player, track) => {
text: `Queue Left: ${player.queue.length} • Loop Mode: ${capital(player.loop)} • Volume: ${player.volume}%`,
});

await nplaying.edit({ embeds: [Started], components: [button, button2] });
await nplaying.edit({ embeds: [Started], components: [menu, button, button2] });
}
} else if (message.customId === "info") {
if (!player) {
Expand Down Expand Up @@ -298,6 +336,59 @@ module.exports.run = async (client, player, track) => {

return message.reply({ embeds: [embed], ephemeral: true });
}
} else if (message.customId === "filters") {
if (!player) {
collector.stop();
} else {
await message.deferUpdate();

const selectedFilter = message.values[0];

if (selectedFilter) {
if (selectedFilter === "clear") {
const embed = new EmbedBuilder().setDescription(`\`☑️\` | Filters has been cleared.`).setColor(client.color);

await player.node.rest.updatePlayer({
guildId: player.guildId,
data: { filters: {} },
});

await player.setVolume(100);

return message.followUp({ embeds: [embed], ephemeral: true });
} else if (selectedFilter === "8d") {
const embed = new EmbedBuilder().setDescription(`\`☑️\` | 8D filter activated.`).setColor(client.color);

await player.filters.set8D(true);

return message.followUp({ embeds: [embed], ephemeral: true });
} else if (selectedFilter === "earrape") {
const embed = new EmbedBuilder().setDescription(`\`☑️\` | Earrape filter activated.`).setColor(client.color);

await player.setVolume(500);

return message.followUp({ embeds: [embed], ephemeral: true });
} else if (selectedFilter === "nightcore") {
const embed = new EmbedBuilder().setDescription(`\`☑️\` | Nightcore filter activated.`).setColor(client.color);

await player.filters.setNightcore(true);

return message.followUp({ embeds: [embed], ephemeral: true });
} else if (selectedFilter === "slowmode") {
const embed = new EmbedBuilder().setDescription(`\`☑️\` | Slowmode filter activated.`).setColor(client.color);

await player.filters.setSlowmode(true);

return message.followUp({ embeds: [embed], ephemeral: true });
} else if (selectedFilter === "vaporwave") {
const embed = new EmbedBuilder().setDescription(`\`☑️\` | Vaporwave filter activated.`).setColor(client.color);

await player.filters.setVaporwave(true);

return message.followUp({ embeds: [embed], ephemeral: true });
}
}
}
}
});
};
5 changes: 1 addition & 4 deletions src/handlers/database/LoadDatabase.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ const { mongoUri } = require("../../settings/config.js");
module.exports = async (client) => {
try {
mongoose.set("strictQuery", false);
mongoose.connect(mongoUri, {
useNewUrlParser: true,
useUnifiedTopology: true,
});
mongoose.connect(mongoUri);
} catch (error) {
console.log(error);
}
Expand Down

0 comments on commit 978867f

Please sign in to comment.