1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-06-18 05:26: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

@ -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!")
}
});
};