diff --git a/DiscordEvents/guildDelete.js b/DiscordEvents/guildDelete.js new file mode 100644 index 0000000..92d4e3c --- /dev/null +++ b/DiscordEvents/guildDelete.js @@ -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}` + ); + } +}; diff --git a/DiscordEvents/ready.js b/DiscordEvents/ready.js index cbfec1d..178c159 100755 --- a/DiscordEvents/ready.js +++ b/DiscordEvents/ready.js @@ -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); } }; diff --git a/package-lock.json b/package-lock.json index 8801758..c01afe2 100755 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 26c8249..0dc8479 100755 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "private": true, "dependencies": { "axios": "^0.19.0", + "blapi": "^1.2.3", "chalk": "^2.4.2", "compression": "*", "cors": "*",