1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-16 18:56:00 +00:00

Update 3.2.2

This commit is contained in:
MatteZ02
2020-04-21 22:10:30 +03:00
parent 3532cc00d3
commit 2a692edf8d
7 changed files with 33 additions and 300 deletions

View File

@ -15,7 +15,6 @@ module.exports = {
id: client.config.spotify_client_id,
secret: client.config.spotify_client_secret,
});
spotify.setAccessToken(client.config.spotify_access_key);
const youtube = new YouTube(client.config.api_key);

View File

@ -41,6 +41,7 @@ module.exports = {
});
dbl.postStats(client.guilds.size);
}
client.funcs.getSpotifyKey(client);
console.log(`- Activated - Shard: ${client.shard.ids} -`);
setInterval(() => {
if (!client.config.devMode) client.funcs.checkDB(client);
@ -50,6 +51,9 @@ module.exports = {
if (client.config.dblApi && !client.config.devMode)
dbl.postStats(client.guilds.cache.size);
}, 1800000);
setInterval(() => {
client.funcs.getSpotifyKey(client);
}, 3600000);
setInterval(() => {
client.funcs.ffmpeg(client, Discord);
}, 7200000);

View File

@ -10,6 +10,7 @@ module.exports = {
spotify_access_key: process.env.SPOTIFY_ACCESS_KEY,
spotify_client_secret: process.env.SPOTIFY_CLIENT_SECRET,
spotify_client_id: process.env.SPOTIFY_CLIENT_ID,
spotify_refresh_token: process.env.SPOTIFY_REFRESH_TOKEN,
port: 8888,
redirectUri: "http://localhost:8888/callback/",
testServer: "489111553321336832",
@ -19,7 +20,7 @@ module.exports = {
embedColor: "#b50002",
invite: "https://discordapp.com/oauth2/authorize?client_id=607266889537945605&permissions=3427328&scope=bot",
supportServer: "https://discord.gg/rvHuJtB",
devMode: false,
devMode: true,
api: false,
saveDB: true,
respawn: true,

View File

@ -0,0 +1,26 @@
module.exports = async function (client) {
let accessKey;
var request = require("request");
var refresh_token = client.config.spotify_refresh_token;
var authOptions = {
url: "https://accounts.spotify.com/api/token",
headers: {
Authorization: "Basic " +
new Buffer(client.config.spotify_client_id + ":" + client.config.spotify_client_secret).toString("base64"),
},
form: {
grant_type: "refresh_token",
refresh_token: refresh_token,
},
json: true,
};
request.post(authOptions, function (error, response, body) {
if (!error && response.statusCode === 200) {
client.config.spotify_access_key = body.access_token
} else {
console.log("An error occured!")
}
});
};