mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-17 00:07:36 +02:00
Fix
This commit is contained in:
+16
-10
@@ -10,14 +10,20 @@ const {
|
|||||||
module.exports = class BotList {
|
module.exports = class BotList {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
Object.defineProperty(this, 'client', { value: client });
|
Object.defineProperty(this, 'client', { value: client });
|
||||||
|
|
||||||
|
this.topGGToken = TOP_GG_TOKEN;
|
||||||
|
this.botsGGToken = BOTS_GG_TOKEN;
|
||||||
|
this.discordBotsListToken = DISCORDBOTLIST_TOKEN;
|
||||||
|
this.carbonToken = CARBON_TOKEN;
|
||||||
|
this.blistToken = BLIST_TOKEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
async postTopGGStats() {
|
async postTopGGStats() {
|
||||||
if (!TOP_GG_TOKEN) return null;
|
if (!this.topGGToken) return null;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.post(`https://top.gg/api/bots/${this.client.user.id}/stats`)
|
.post(`https://top.gg/api/bots/${this.client.user.id}/stats`)
|
||||||
.set({ Authorization: TOP_GG_TOKEN })
|
.set({ Authorization: this.topGGToken })
|
||||||
.send({ server_count: this.client.guilds.cache.size });
|
.send({ server_count: this.client.guilds.cache.size });
|
||||||
this.client.logger.info('[TOP.GG] Posted stats.');
|
this.client.logger.info('[TOP.GG] Posted stats.');
|
||||||
return body;
|
return body;
|
||||||
@@ -28,11 +34,11 @@ module.exports = class BotList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async postBotsGGStats() {
|
async postBotsGGStats() {
|
||||||
if (!BOTS_GG_TOKEN) return null;
|
if (!this.botsGGToken) return null;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.post(`https://discord.bots.gg/api/v1/bots/${this.client.user.id}/stats`)
|
.post(`https://discord.bots.gg/api/v1/bots/${this.client.user.id}/stats`)
|
||||||
.set({ Authorization: BOTS_GG_TOKEN })
|
.set({ Authorization: this.botsGGToken })
|
||||||
.send({ guildCount: this.client.guilds.cache.size });
|
.send({ guildCount: this.client.guilds.cache.size });
|
||||||
this.client.logger.info('[BOTS.GG] Posted stats.');
|
this.client.logger.info('[BOTS.GG] Posted stats.');
|
||||||
return body;
|
return body;
|
||||||
@@ -43,11 +49,11 @@ module.exports = class BotList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async postDiscordBotListStats() {
|
async postDiscordBotListStats() {
|
||||||
if (!DISCORDBOTLIST_TOKEN) return null;
|
if (!this.discordBotsListToken) return null;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.post(`https://discordbotlist.com/api/v1/bots/${this.client.user.id}/stats`)
|
.post(`https://discordbotlist.com/api/v1/bots/${this.client.user.id}/stats`)
|
||||||
.set({ Authorization: DISCORDBOTLIST_TOKEN })
|
.set({ Authorization: this.discordBotsListToken })
|
||||||
.send({
|
.send({
|
||||||
guilds: this.client.guilds.cache.size,
|
guilds: this.client.guilds.cache.size,
|
||||||
users: this.client.users.cache.size,
|
users: this.client.users.cache.size,
|
||||||
@@ -62,12 +68,12 @@ module.exports = class BotList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async postCarbonStats() {
|
async postCarbonStats() {
|
||||||
if (!CARBON_TOKEN) return null;
|
if (!this.carbonToken) return null;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
.post('https://www.carbonitex.net/discord/data/botdata.php')
|
||||||
.send({
|
.send({
|
||||||
key: CARBON_TOKEN,
|
key: this.carbonToken,
|
||||||
servercount: this.client.guilds.cache.size,
|
servercount: this.client.guilds.cache.size,
|
||||||
botid: this.client.user.id
|
botid: this.client.user.id
|
||||||
});
|
});
|
||||||
@@ -80,11 +86,11 @@ module.exports = class BotList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async postBlistStats() {
|
async postBlistStats() {
|
||||||
if (!BLIST_TOKEN) return null;
|
if (!this.blistToken) return null;
|
||||||
try {
|
try {
|
||||||
const { body } = await request
|
const { body } = await request
|
||||||
.patch(`https://blist.xyz/api/v2/bot/${this.client.user.id}/stats/`)
|
.patch(`https://blist.xyz/api/v2/bot/${this.client.user.id}/stats/`)
|
||||||
.set({ Authorization: BLIST_TOKEN })
|
.set({ Authorization: this.blistToken })
|
||||||
.send({ server_count: this.client.guilds.cache.size });
|
.send({ server_count: this.client.guilds.cache.size });
|
||||||
this.client.logger.info('[BLIST] Posted stats.');
|
this.client.logger.info('[BLIST] Posted stats.');
|
||||||
return body;
|
return body;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ module.exports = class Patreon {
|
|||||||
this.patrons = [];
|
this.patrons = [];
|
||||||
this.forced = [];
|
this.forced = [];
|
||||||
this.accessToken = accessToken || PATREON_ACCESS_TOKEN;
|
this.accessToken = accessToken || PATREON_ACCESS_TOKEN;
|
||||||
this.campignID = campaignID || PATREON_CAMPAIGN_ID;
|
this.campaignID = campaignID || PATREON_CAMPAIGN_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
isPatron(id) {
|
isPatron(id) {
|
||||||
@@ -16,7 +16,7 @@ module.exports = class Patreon {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchPatrons() {
|
async fetchPatrons() {
|
||||||
if (!this.accessToken || !this.campignID) return null;
|
if (!this.accessToken || !this.campaignID) return null;
|
||||||
const { text } = await request
|
const { text } = await request
|
||||||
.get(`https://www.patreon.com/api/oauth2/v2/campaigns/${PATREON_CAMPAIGN_ID}/members`)
|
.get(`https://www.patreon.com/api/oauth2/v2/campaigns/${PATREON_CAMPAIGN_ID}/members`)
|
||||||
.set({ Authorization: `Bearer ${PATREON_ACCESS_TOKEN}` })
|
.set({ Authorization: `Bearer ${PATREON_ACCESS_TOKEN}` })
|
||||||
|
|||||||
Reference in New Issue
Block a user