mirror of
https://github.com/MinazukiAmane/Tinasha-Bot.git
synced 2025-03-16 04:55:58 +08:00
migration part 2
This commit is contained in:
parent
e51e502116
commit
da0c8479bb
@ -3,5 +3,5 @@
|
|||||||
* @param {any} data
|
* @param {any} data
|
||||||
*/
|
*/
|
||||||
module.exports = async (client, data) => {
|
module.exports = async (client, data) => {
|
||||||
client.musicManager.updateVoiceState(data);
|
//client.musicManager.updateVoiceState(data);
|
||||||
};
|
};
|
||||||
|
@ -12,7 +12,9 @@ module.exports = async (client) => {
|
|||||||
|
|
||||||
// Initialize Music Manager
|
// Initialize Music Manager
|
||||||
client.logger.log("Initializing music manager");
|
client.logger.log("Initializing music manager");
|
||||||
client.musicManager.init(client.user.id);
|
client.musicManager.init({
|
||||||
|
id: client.user.id
|
||||||
|
});
|
||||||
|
|
||||||
// Update Bot Presence
|
// Update Bot Presence
|
||||||
if (PRESENCE.ENABLED) {
|
if (PRESENCE.ENABLED) {
|
||||||
|
@ -17,7 +17,7 @@ module.exports = async (client, oldState, newState) => {
|
|||||||
// if 1 (you), wait 1 minute
|
// if 1 (you), wait 1 minute
|
||||||
if (!oldState.channel.members.size - 1)
|
if (!oldState.channel.members.size - 1)
|
||||||
// if there's still 1 member,
|
// if there's still 1 member,
|
||||||
client.musicManager.get(guild.id) && client.musicManager.get(guild.id).destroy();
|
client.musicManager.getPlayer(guild.id)?.destroy();
|
||||||
}, MUSIC.IDLE_TIME * 1000);
|
}, MUSIC.IDLE_TIME * 1000);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1,41 +1,19 @@
|
|||||||
const { Manager } = require("erela.js");
|
const { MUSIC } = require('@root/config');
|
||||||
const Deezer = require("erela.js-deezer");
|
const lavalink = require('lavalink-client');
|
||||||
const Facebook = require("erela.js-facebook");
|
|
||||||
const Spotify = require("erela.js-spotify");
|
|
||||||
const { MUSIC } = require("@root/config");
|
|
||||||
const ytsr = require('ytsr');
|
|
||||||
|
|
||||||
module.exports = class MusicManager extends Manager {
|
module.exports = class MusicManager extends lavalink.LavalinkManager {
|
||||||
|
/**
|
||||||
|
* @param {import('discord.js').Client} client
|
||||||
|
*/
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
const plugins = [
|
|
||||||
new Deezer({
|
|
||||||
albumLimit: 1,
|
|
||||||
playlistLimit: 1,
|
|
||||||
}),
|
|
||||||
|
|
||||||
new Facebook(),
|
|
||||||
];
|
|
||||||
|
|
||||||
if (process.env.SPOTIFY_CLIENT_ID && process.env.SPOTIFY_CLIENT_SECRET) {
|
|
||||||
plugins.push(
|
|
||||||
new Spotify({
|
|
||||||
clientID: process.env.SPOTIFY_CLIENT_ID,
|
|
||||||
clientSecret: process.env.SPOTIFY_CLIENT_SECRET,
|
|
||||||
albumLimit: 10,
|
|
||||||
playlistLimit: 10,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
super({
|
super({
|
||||||
nodes: MUSIC.NODES,
|
nodes: MUSIC.NODES,
|
||||||
autoPlay: true,
|
|
||||||
plugins,
|
|
||||||
|
|
||||||
send: (id, payload) => {
|
sendToShard: (id, payload) => {
|
||||||
const guild = client.guilds.cache.get(id);
|
client.guilds.cache.get(id)?.s,hard.send(payload);
|
||||||
if (guild) guild.shard.send(payload);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
queueOptions: {}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user