mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 22:32:50 +02:00
Remove Server Stats
This commit is contained in:
+1
-8
@@ -7,11 +7,8 @@ const client = new CommandoClient({
|
|||||||
invite: INVITE,
|
invite: INVITE,
|
||||||
disableEveryone: true,
|
disableEveryone: true,
|
||||||
unknownCommandResponse: false,
|
unknownCommandResponse: false,
|
||||||
disabledEvents: ['TYPING_START'],
|
disabledEvents: ['TYPING_START']
|
||||||
messageCacheLifetime: 600,
|
|
||||||
messageSweepInterval: 120
|
|
||||||
});
|
});
|
||||||
const { postStats } = require('./util/Util');
|
|
||||||
|
|
||||||
client.registry
|
client.registry
|
||||||
.registerDefaultTypes()
|
.registerDefaultTypes()
|
||||||
@@ -53,10 +50,6 @@ client.on('ready', () => {
|
|||||||
}, 60000);
|
}, 60000);
|
||||||
});
|
});
|
||||||
|
|
||||||
client.on('guildCreate', () => postStats(client));
|
|
||||||
|
|
||||||
client.on('guildDelete', () => postStats(client));
|
|
||||||
|
|
||||||
client.on('disconnect', event => {
|
client.on('disconnect', event => {
|
||||||
console.error(`[DISCONNECT] Shard ${client.shard.id} disconnected with code ${event.code}.`);
|
console.error(`[DISCONNECT] Shard ${client.shard.id} disconnected with code ${event.code}.`);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
const { Command } = require('discord.js-commando');
|
|
||||||
const snekfetch = require('snekfetch');
|
|
||||||
const { stripIndents } = require('common-tags');
|
|
||||||
const { DBOTSORG_KEY } = process.env;
|
|
||||||
|
|
||||||
module.exports = class UpvoteCommand extends Command {
|
|
||||||
constructor(client) {
|
|
||||||
super(client, {
|
|
||||||
name: 'upvote',
|
|
||||||
aliases: ['upvoters', 'updoot'],
|
|
||||||
group: 'util',
|
|
||||||
memberName: 'upvote',
|
|
||||||
description: 'Responds with Xiao\'s upvoter link on discordbots.org.',
|
|
||||||
guarded: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(msg) {
|
|
||||||
try {
|
|
||||||
const { body } = await snekfetch
|
|
||||||
.get(`https://discordbots.org/api/bots/${this.client.user.id}/votes`)
|
|
||||||
.set({ Authorization: DBOTSORG_KEY });
|
|
||||||
return msg.say(stripIndents`
|
|
||||||
Upvote Xiao and get rewards while joining ${body.length} others!
|
|
||||||
<https://discordbots.org/bot/xiaobot>
|
|
||||||
`);
|
|
||||||
} catch (err) {
|
|
||||||
return msg.say(stripIndents`
|
|
||||||
Upvote Xiao and get rewards!
|
|
||||||
<https://discordbots.org/bot/xiaobot>
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiaobot",
|
"name": "xiaobot",
|
||||||
"version": "49.2.1",
|
"version": "49.2.2",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Shard.js",
|
"main": "Shard.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,32 +1,8 @@
|
|||||||
const snekfetch = require('snekfetch');
|
|
||||||
const { promisify } = require('util');
|
const { promisify } = require('util');
|
||||||
const { DBOTS_KEY, DBOTSORG_KEY } = process.env;
|
|
||||||
const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea'];
|
const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea'];
|
||||||
const no = ['no', 'n', 'nah', 'nope'];
|
const no = ['no', 'n', 'nah', 'nope'];
|
||||||
|
|
||||||
class Util {
|
class Util {
|
||||||
static postStats(client) {
|
|
||||||
if (!DBOTS_KEY || !DBOTSORG_KEY) return;
|
|
||||||
snekfetch
|
|
||||||
.post(`https://bots.discord.pw/api/bots/${client.user.id}/stats`)
|
|
||||||
.set({ Authorization: DBOTS_KEY })
|
|
||||||
.send({
|
|
||||||
shard_id: client.shard ? client.shard.id : 0,
|
|
||||||
shard_count: client.options.shardCount || 1,
|
|
||||||
server_count: client.guilds.size
|
|
||||||
})
|
|
||||||
.catch(err => console.error('[STATS] Failed to post to bots.discord.pw.', err));
|
|
||||||
snekfetch
|
|
||||||
.post(`https://discordbots.org/api/bots/${client.user.id}/stats`)
|
|
||||||
.set({ Authorization: DBOTSORG_KEY })
|
|
||||||
.send({
|
|
||||||
shard_id: client.shard ? client.shard.id : 0,
|
|
||||||
shard_count: client.options.shardCount || 1,
|
|
||||||
server_count: client.guilds.size
|
|
||||||
})
|
|
||||||
.catch(err => console.error('[STATS] Failed to post to discordbots.org.', err));
|
|
||||||
}
|
|
||||||
|
|
||||||
static wait(time) {
|
static wait(time) {
|
||||||
return promisify(setTimeout)(time);
|
return promisify(setTimeout)(time);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user