post stats to lists

This commit is contained in:
codepupper 2019-11-11 23:43:00 +01:00
parent 84783efd7f
commit 742c627348
4 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,27 @@
const { logChannel } = require('../config');
const util = require('../utils');
module.exports = {
name: 'guildDelete',
run: async (client, guild) => {
const logs = client.channels.get(logChannel);
const members = await guild.members.fetch();
guild.utils = util;
guild.guild = guild;
const total = guild.members.size;
const users = guild.members.filter((m) => !m.user.bot).size;
const bots = guild.members.filter((m) => m.user.bot).size;
if (logs)
logs.send(
`Removed from ${guild.name} (owned by: ${guild.owner.user.tag ||
'uncached'} ${guild.ownerID}) on shard ${client.options.shards[client.options.shards.length - 1] +
1}/${client.options.shards.length}\nServer has ${parseInt(total).toLocaleString()} member${total > 1
? 's'
: ''}: ${parseInt(users).toLocaleString()} user${users > 1 ? 's' : ''}, ${parseInt(
bots
).toLocaleString()} bot${bots > 1 ? 's' : ''}, in region ${guild.region}`
);
}
};

View File

@ -1,9 +1,31 @@
const { log } = require('../utils/index');
const { log } = require('../utils');
const config = require('../config');
const blapi = require('blapi');
//blapi.setLogging(true);
function randomStatus(client) {
const States = [
{ activity: { name: 'server fans whirr 💨', type: 'LISTENING' }, status: 'online' },
{ activity: { name: "my master's keyboard -w-", type: 'LISTENING' }, status: 'online' },
{ activity: { name: client.guilds.size + ' Servers -w-', type: 'WATCHING' }, status: 'online' },
// { game: { name: `${client.users.get('318044130796109825').username} dance~`, type: 'WATCHING' }, status: 'dnd' },
// { game: { name: thal.users.size + ' Wolves', type: 'WATCHING' }, status: 'dnd' },
{ activity: { name: 'Δ & ♫', type: 'LISTENING' }, status: 'online' },
{ activity: { name: `'help | thaldr.in`, type: 'WATCHING' }, status: 'online' }
// { game: { name: `over ${thal.users.get('318044130796109825').username}~`, type: 'WATCHING' }, status: 'dnd' }
];
let status = States[~~(Math.random() * States.length)];
return client.user.setPresence(status);
}
module.exports = {
name: 'ready',
run: async (client) => {
blapi.handle(client, config.apis);
log.hasStarted();
client.user.setActivity(`'help | thaldr.in`, { type: `WATCHING` });
randomStatus(client);
setInterval(() => {
randomStatus(client);
}, 60000);
}
};

8
package-lock.json generated
View File

@ -98,6 +98,14 @@
"file-uri-to-path": "1.0.0"
}
},
"blapi": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/blapi/-/blapi-1.2.3.tgz",
"integrity": "sha512-ZmVVHPTwiOtxoW9ouzvdGgPtF84f5rlkepQPAKacuwJNH9oCFNsHVlKmUr6QopAgMTFB/x3YMP1yFgMrw2MAgQ==",
"requires": {
"node-fetch": "^2.6.0"
}
},
"body-parser": {
"version": "1.19.0",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",

View File

@ -8,6 +8,7 @@
"private": true,
"dependencies": {
"axios": "^0.19.0",
"blapi": "^1.2.3",
"chalk": "^2.4.2",
"compression": "*",
"cors": "*",