Skip to content

Commit

Permalink
Update v2.2.0
Browse files Browse the repository at this point in the history
Whats Change?
- Updated to the latest Poru
- Added support for AppleMusic & Deezer link (Link Only)
- Some changes due to Poru & Poru plugins updated.
  • Loading branch information
adh319 committed Oct 6, 2023
1 parent 46086ad commit bc124c0
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LEAVE_TIMEOUT = 60000 #Time in ms to leave the voice channel after the last user
DISABLE_PREMIUM = false #Disable premium system

#PORU DETAILS
PLAY_SOURCE = ytmsearch #Default source to play the searched songs (ytmsearch, ytsearch, scsearch, or spotify). More? Use LavaSrc plugin
DEFAULT_PLATFORM = ytmsearch #recomended using "ytmsearch". You can change this to: "ytsearch" / "ytmsearch" / "scsearch". More Audio Source? Use Lavasrc plugin.LavaSrc plugin
SPOTIFY_ID = #Spotify client id
SPOTIFY_SECRET = #Spotify client secret
NODE_NAME = Lunox #Name of the lavalink, could be anything
Expand Down
19 changes: 8 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lunox",
"version": "2.1.5",
"version": "2.2.0",
"description": "Lunox by @adh319#9370",
"main": "sharder.js",
"scripts": {
Expand All @@ -15,12 +15,14 @@
"google-search-url": "^0.1.8",
"moment": "^2.29.4",
"moment-duration-format": "^2.3.2",
"mongoose": "^6.11.5",
"mongoose": "^7.5.4",
"node-capitalize": "^1.0.0",
"node-cron": "^3.0.2",
"node-fetch": "^2.6.13",
"node-fetch": "^2.7.0",
"poru": "github:parasop/poru",
"poru-spotify": "^2.0.2",
"poru-applemusic": "github:parasop/poru-applemusic",
"poru-deezer": "github:parasop/poru-deezer",
"poru-spotify": "github:parasop/poru-spotify",
"pretty-ms": "^7.0.1",
"voucher-code-generator": "^1.3.0"
},
Expand All @@ -33,10 +35,5 @@
"bugs": {
"url": "https://github.com/adh319/Lunox#issues"
},
"homepage": "https://github.com/adh319/Lunox/#readme",
"devDependencies": {
"@types/node-cron": "^3.0.8",
"@types/voucher-code-generator": "^1.1.1",
"node": "^18.17.1"
}
}
"homepage": "https://github.com/adh319/Lunox/#readme"
}
4 changes: 1 addition & 3 deletions src/commands/Slash/Music/Play.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ module.exports = {
return interaction.editReply({ embeds: [embed] });
}

let playSource = client.config.playSource;

const res = await client.poru.resolve({ query: song, source: playSource, requester: interaction.user });
const res = await client.poru.resolve({ query: song, requester: interaction.user });
const { loadType, tracks, playlistInfo } = res;

if (loadType === "LOAD_FAILED" || loadType === "NO_MATCHES") {
Expand Down
4 changes: 1 addition & 3 deletions src/commands/Slash/Music/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ module.exports = {

await interaction.deferReply({ ephemeral: false });

let playSource = client.config.playSource;

const res = await client.poru.resolve({ query: query, source: playSource, requester: interaction.user });
const res = await client.poru.resolve({ query: query, requester: interaction.user });
const { tracks } = res;

const results = tracks.slice(0, 10);
Expand Down
3 changes: 1 addition & 2 deletions src/events/poruEvents/player/trackEnd.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ module.exports.run = async (client, player) => {
const ytUri = /^(https?:\/\/)?(www\.)?(m\.)?(music\.)?(youtube\.com|youtu\.?be)\/.+$/gi.test(trackSearch.uri);

if (ytUri) {
const playSource = client.config.playSource;
const identifier = trackSearch.identifier;
const search = `https://music.youtube.com/watch?v=${identifier}&list=RD${identifier}`;
const res = await client.poru.resolve({ query: search, source: playSource, requester: trackSearch.requester });
const res = await client.poru.resolve({ query: search, source: "ytmsearch", requester: trackSearch.requester });

await player.queue.add(res.tracks[Math.floor(Math.random() * res.tracks.length) ?? 2]);
}
Expand Down
9 changes: 7 additions & 2 deletions src/settings/config.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
require("dotenv").config();
const { customFilter } = require("poru");
const { AppleMusic } = require("poru-applemusic");
const { Deezer } = require("poru-deezer");
const { Spotify } = require("poru-spotify");

const applemusic = new AppleMusic({ contryCode: "us" }); // I dont know why its "contryCode" instead of "countryCode", ask paras for it xD.
const deezer = new Deezer();
const spotify = new Spotify({
clientID: process.env.SPOTIFY_ID || " ",
clientSecret: process.env.SPOTIFY_SECRET || " ",
clients: [{ clientID: process.env.SPOTIFY_ID || " ", clientSecret: process.env.SPOTIFY_SECRET || " " }], // its seem this is a bug from the plugin, so if u dont add this, it will throw an error.
});

module.exports = {
Expand All @@ -18,11 +23,11 @@ module.exports = {
disablePremium: parseBoolean(process.env.DISABLE_PREMIUM || "false"), // disable premium command

// PORU DETAILS
playSource: process.env.PLAY_SOURCE || "ytmsearch", // recomended using "ytmsearch" or "spotify". You can change this to: "ytsearch" / "ytmsearch" / "scsearch" / "spotify". More? Use Lavasrc plugin.
poruOptions: {
customFilter,
library: "discord.js", // This source made by using discord.js, so don't even try to change this thing :)
plugins: [spotify], // Enable spotify link to be readable by poru without using LavaSrc plugin.
defaultPlatform: process.env.DEFAULT_PLATFORM || " ", // recomended using "ytmsearch". You can change this to: "ytsearch" / "ytmsearch" / "scsearch". More Audio Source? Use Lavasrc plugin.
plugins: [applemusic, deezer, spotify], // Enable applemusic/deezer/spotify LINK to be readable by poru without using LavaSrc plugin.
reconnectTries: Infinity, // total attemps to try if reconnect failed. you can change it to "Infinity" for unlimited attemps.
reconnectTimeout: 10000, // total time to try reconnect in ms. 1000 = 1sec
},
Expand Down

0 comments on commit bc124c0

Please sign in to comment.