<commit_before>const config = require('./config.json');
const fs = require('fs');
const moment = require('moment');
const blacklist = require('./serverconf/blacklist.json');
var timestamp;

module.exports = {
	"ready": function ready(client, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		console.log(`[${timestamp}]${chalk.green("[POWER]")} ${client.user.username} ready!`);
		client.user.setGame(`try '${config.commandPrefix} help' !`);
	},
	"error": function error(client, error, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		console.log(`[${timestamp}]${chalk.red("[CONNECTION]")} ${client.user.username} encountered a "serious connection error! | ${error.code}`);
	},
	"disconnect": function disconnect(client, error, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		console.log(`[${timestamp}]${chalk.red("[CONNECTION]")} ${client.user.username} was disconnected! | ${error.code}`);
		if(error.code == 1000) {
			console.log(`[${timestamp}]${chalk.green("[POWER]")} Automatically restarting...`);
			client.destroy().then(() => client.login(config.token));
			// Restart bot if disconnect code is 1000 (gracefully exited) because it won't reconnect automatically
		};
	},
	"reconnecting": function reconnecting(client, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		console.log(`[${timestamp}]${chalk.green("[CONNECTION]")} ${client.user.username} is reconnecting!`);
	},
	"join": function join(client, guild, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		if(blacklist.includes(guild.id)) return guild.leave();
		// blacklist check
		console.log(`[${timestamp}]${chalk.yellow("[GUILDS]")} ${client.user.username} has joined a new server! ("${guild.name}")`);
		fs.appendFileSync(`${config.logPath}${config.serverLog}`, `\n[${timestamp}][GUILDS] ${client.user.username} joined the '${guild.name}' server!`);
	},
	"leave": function leave(client, guild, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		if(blacklist.includes(guild.id)) return;
		// blacklist check
		console.log(`[${timestamp}]${chalk.yellow("[GUILDS]")} ${client.user.username} has left a server! ("${guild.name}")`);
		fs.appendFileSync(`${config.logPath}${config.serverLog}`, `\n[${timestamp}][GUILDS] ${client.user.username} left the '${guild.name}' server!`);
	}
};<commit_msg>Automatically leave guilds with more than 80% bots<commit_after>const config = require('./config.json');
const fs = require('fs');
const moment = require('moment');
const blacklist = require('./serverconf/blacklist.json');
var timestamp;

module.exports = {
	"ready": function ready(client, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		console.log(`[${timestamp}]${chalk.green("[POWER]")} ${client.user.username} ready!`);
		client.user.setGame(`try '${config.commandPrefix} help' !`);
	},
	"error": function error(client, error, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		console.log(`[${timestamp}]${chalk.red("[CONNECTION]")} ${client.user.username} encountered a "serious connection error! | ${error.code}`);
	},
	"disconnect": function disconnect(client, error, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		console.log(`[${timestamp}]${chalk.red("[CONNECTION]")} ${client.user.username} was disconnected! | ${error.code}`);
		if(error.code == 1000) {
			console.log(`[${timestamp}]${chalk.green("[POWER]")} Automatically restarting...`);
			client.destroy().then(() => client.login(config.token));
			// Restart bot if disconnect code is 1000 (gracefully exited) because it won't reconnect automatically
		};
	},
	"reconnecting": function reconnecting(client, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		console.log(`[${timestamp}]${chalk.green("[CONNECTION]")} ${client.user.username} is reconnecting!`);
	},
	"join": function join(client, guild, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		if(guild.members.filter(m => m.user.bot).size>=(guild.memberCount/100*80)) return guild.leave();
		// bot percentage check
		if(blacklist.includes(guild.id)) return guild.leave();
		// blacklist check
		console.log(`[${timestamp}]${chalk.yellow("[GUILDS]")} ${client.user.username} has joined a new server! ("${guild.name}")`);
		fs.appendFileSync(`${config.logPath}${config.serverLog}`, `\n[${timestamp}][GUILDS] ${client.user.username} joined the '${guild.name}' server!`);
	},
	"leave": function leave(client, guild, chalk) {
		timestamp = moment().format('DD/MM/YYYY HH:mm:ss');
		if(guild.members.filter(m => m.user.bot).size>=(guild.memberCount/100*80)) return;
		// bot percentage check
		if(blacklist.includes(guild.id)) return;
		// blacklist check
		console.log(`[${timestamp}]${chalk.yellow("[GUILDS]")} ${client.user.username} has left a server! ("${guild.name}")`);
		fs.appendFileSync(`${config.logPath}${config.serverLog}`, `\n[${timestamp}][GUILDS] ${client.user.username} left the '${guild.name}' server!`);
	}
};
{'fraction_non_alphanumeric': 0.21968330326718782, 'fraction_numerical': 0.005612347163760273, 'mean_word_length': 5.949860724233983, 'pattern_counts': {'":': 12, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2525406', 'n_tokens_mistral': 1769, 'n_tokens_neox': 1680, 'n_words': 306}