1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-12-23 03:33:17 +00:00

botList api

This commit is contained in:
MatteZ02 2020-04-25 12:33:36 +03:00
parent 55164ae0f3
commit ee949b5cb8
4 changed files with 46 additions and 14 deletions

13
package-lock.json generated
View File

@ -897,6 +897,14 @@
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
"integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg=="
}, },
"bodapi.js": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/bodapi.js/-/bodapi.js-1.1.1.tgz",
"integrity": "sha512-i0Ac40YImF69ncDJUV/fVK+2RKXu7A722pxxnzQMG9kZyRDMdQUVsA83d0rQTY5bsBr5Ndhb2p03YAHACnJXFw==",
"requires": {
"typescript": "^3.8.3"
}
},
"body-parser": { "body-parser": {
"version": "1.19.0", "version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
@ -3736,6 +3744,11 @@
"is-typedarray": "^1.0.0" "is-typedarray": "^1.0.0"
} }
}, },
"typescript": {
"version": "3.8.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.3.tgz",
"integrity": "sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w=="
},
"unique-string": { "unique-string": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz",

View File

@ -17,6 +17,7 @@
}, },
"homepage": "https://github.com/MatteZ02/Musix-V3#readme", "homepage": "https://github.com/MatteZ02/Musix-V3#readme",
"dependencies": { "dependencies": {
"bodapi.js": "^1.1.1",
"bufferutil": "^4.0.1", "bufferutil": "^4.0.1",
"cookie-parser": "^1.4.5", "cookie-parser": "^1.4.5",
"cors": "^2.8.5", "cors": "^2.8.5",

View File

@ -1,5 +1,3 @@
const DBL = require("dblapi.js");
module.exports = { module.exports = {
name: "ready", name: "ready",
async execute(client, Discord) { async execute(client, Discord) {
@ -30,17 +28,8 @@ module.exports = {
client.user.setActivity(`@${client.user.username} help | 🎶`, { client.user.setActivity(`@${client.user.username} help | 🎶`, {
type: "LISTENING", type: "LISTENING",
}); });
if (client.config.dblApi && !client.config.devMode) client.funcs.botListApi(client);
client.user.setStatus("online"); client.user.setStatus("online");
const dbl = new DBL(client.config.dblKey, client);
if (client.config.dblApi && !client.config.devMode) {
dbl.on("posted", () => {
console.log("Server count posted!");
});
dbl.on("error", (error) => {
console.log("Error with DBL: " + error);
});
dbl.postStats(client.guilds.size);
}
client.funcs.getSpotifyKey(client); client.funcs.getSpotifyKey(client);
console.log(`- Activated - Shard: ${client.shard.ids} -`); console.log(`- Activated - Shard: ${client.shard.ids} -`);
setInterval(() => { setInterval(() => {
@ -48,8 +37,6 @@ module.exports = {
}, 60000); }, 60000);
setInterval(async () => { setInterval(async () => {
client.funcs.saveDB(client); client.funcs.saveDB(client);
if (client.config.dblApi && !client.config.devMode)
dbl.postStats(client.guilds.cache.size);
}, 1800000); }, 1800000);
setInterval(() => { setInterval(() => {
client.funcs.getSpotifyKey(client); client.funcs.getSpotifyKey(client);

View File

@ -0,0 +1,31 @@
module.exports = function (client) {
const DBL = require("dblapi.js");
const dbl = new DBL(client.config.dblKey, client);
const bod_api = require("bodapi.js");
const bod = new bod_api("Your api token", client);
dbl.on("error", (e) => {
console.log(`DBL error: ${e}`);
});
bod.on("error", (e) => {
console.log(`BOD error ${e}`);
});
/*const authOptions = {
url: "https://discord.bots.gg/bots/607266889537945605/stats",
headers: {
Host: "https://discord.bots.gg/api/v1",
Authorization: client.config.botListKey,
Content - Type: "application/json",
{
"guildCount": 10
}
}
}*/
setInterval(() => {
dbl.postStats(
client.guilds.cache.size,
client.shard.ids,
client.config.shards
);
}, 1800000);
};