<commit_before>const request = require('request');
const fs = require('fs');
const moment = require('moment');
const Discord = require('discord.js');
const config = require('./config.json');
const bot = new Discord.Client();


bot.on('ready', () => {
	console.log(bot.user.username + " ready! ");
	bot.user.setGame('on megumin.love');
});

bot.on('message', msg => {
	if(msg.content == "!help") {
		// Todo
	};
    if(msg.content == "!counter") {
        request('https://megumin.love/includes/get_cache.php?update=1', function (error, response, body){
            msg.channel.sendMessage("Current count is: " + body.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1."));
        });
    };
	if(msg.content == "!submit") {
		msg.channel.sendMessage("Want to submit a sound for the website/bot? No problem, send me an email at `<EMAIL>` including your cropped mp3/aac/ogg sound file! All sounds need to fit the website's theme.");	
	}
	if(msg.content == "!randomsound") {
		if(msg.member.voiceChannel){
			request('https://megumin.love/includes/cache_counter.php?count=1', function (error, response, body){}); 
			msg.member.voiceChannel.join().then(connection => {
				console.log(`Connected to ${msg.member.voiceChannel.name}!`);
				var sounds = ["eugh1.mp3", "eugh2.mp3", "eugh3.mp3", "eugh4.mp3", "explosion.mp3", "itai.mp3", "n.mp3", "name.mp3", "plosion.mp3", "pull.mp3", "sion.mp3", "yamero.mp3"]; 
				var sound = sounds[Math.floor(Math.random()*sounds.length)];
				const player = connection.playFile(config.soundPath + sound);
				console.log(`"${config.soundPath + sound}" played in ${msg.member.voiceChannel.name}! (${msg.author.username}#${msg.author.discriminator})`);
				fs.appendFileSync(`${config.logPath}${config.soundLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`, function(error){});
				console.log(`Logged into "${config.logPath}${config.soundLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
				player.on('end', () => {
					msg.member.voiceChannel.leave();
					console.log(`Disconnected from ${msg.member.voiceChannel.name}!`);
				});
			});
		}
		else{
			msg.reply("join a voice channel first!");
			return;
		};
	};
	if(msg.content.startsWith("!setGame")) {
		if(msg.author.id !== config.ownerID){
			msg.reply("you are not authorized to use this command!");
			console.log(`${msg.author.username}#${msg.author.discriminator} tried to change the bot's game, but failed!`);
			fs.appendFileSync(`${config.logPath}${config.gameChangeLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command, but failed!`, function(error){});
			console.log(`Logged into "${config.logPath}${config.logName}" ! (${msg.author.username}#${msg.author.discriminator})`);
			return;
		}
		else {
			bot.user.setGame(msg.content.substr(8));
			msg.reply(`successfully set my game to '${msg.content.substr(8)}' !`);
			fs.appendFileSync(`${config.logPath}${config.gameChangeLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`, function(error){});
			console.log(`Logged into "${config.logPath}${config.gameChangeLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${bot.user.username}'s game set to '${msg.content.substr(8)} ' ! (${msg.author.username}#${msg.author.discriminator})`)
		};
	};
	if(msg.content == "!clearGame") {
		if(msg.author.id !== config.ownerID){
			msg.reply("you are not authorized to use this command!");
			fs.appendFileSync(`${config.logPath}${config.gameChangeLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`, function(error){});
			console.log(`Logged into "${config.logPath}${config.gameChangeLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${msg.author.username}#${msg.author.discriminator} tried to clear the bot's game, but failed!`);
			return;
		}
		else {
			bot.user.setGame();	
			fs.appendFileSync(`${config.logPath}${config.gameChangeLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`, function(error){});
			console.log(`Logged into "${config.logPath}${config.gameChangeLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${bot.user.username}'s game status reset! (${msg.author.username}#${msg.author.discriminator})`);
			msg.reply("game status cleared!");
		};
	};
	if(msg.content == "!shutdown") {
		if(msg.author.id !== config.ownerID){
			msg.reply("you are not authorized to use this command!");
			fs.appendFileSync(`${config.logPath}${config.shutdownLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command, but failed!`, function(error){});
			console.log(`Logged into "${config.logPath}${config.shutdownLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${msg.author.username}#${msg.author.discriminator} tried to shutdown the bot, but failed!`);
			return;
		}
		else {
			msg.reply(`${bot.user.username} shutting down! Bye!`);
			fs.appendFileSync(`${config.logPath}${config.shutdownLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`, function(error){});
			console.log(`Logged into "${config.logPath}${config.shutdownLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${bot.user.username} shutting down! (${msg.author.username}#${msg.author.discriminator})`);
			setTimeout(function(){process.exit(0)}, 1500);
		};
	};
});

bot.login(config.token);<commit_msg>Fix stupidity (not really, a desperate attempt)<commit_after>const request = require('request');
const fs = require('fs');
const moment = require('moment');
const Discord = require('discord.js');
const config = require('./config.json');
const bot = new Discord.Client();


bot.on('ready', () => {
	console.log(bot.user.username + " ready! ");
	bot.user.setGame('on megumin.love');
});

bot.on('message', msg => {
	if(msg.content == "!help") {
		// Todo
	};
    if(msg.content == "!counter") {
        request('https://megumin.love/includes/get_cache.php?update=1', function (error, response, body){
            msg.channel.sendMessage("Current count is: " + body.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1."));
        });
    };
	if(msg.content == "!submit") {
		msg.channel.sendMessage("Want to submit a sound for the website/bot? No problem, send me an email at `<EMAIL>` including your cropped mp3/aac/ogg sound file! All sounds need to fit the website's theme.");	
	}
	if(msg.content == "!randomsound") {
		if(msg.member.voiceChannel){
			request('https://megumin.love/includes/cache_counter.php?count=1', function (error, response, body){}); 
			msg.member.voiceChannel.join().then(connection => {
				console.log(`Connected to ${msg.member.voiceChannel.name}!`);
				var sounds = ["eugh1.mp3", "eugh2.mp3", "eugh3.mp3", "eugh4.mp3", "explosion.mp3", "itai.mp3", "n.mp3", "name.mp3", "plosion.mp3", "pull.mp3", "sion.mp3", "yamero.mp3"]; 
				var sound = sounds[Math.floor(Math.random()*sounds.length)];
				const player = connection.playFile(config.soundPath + sound);
				console.log(`"${config.soundPath + sound}" played in ${msg.member.voiceChannel.name}! (${msg.author.username}#${msg.author.discriminator})`);
				fs.appendFileSync(`${config.logPath}${config.soundLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`);
				console.log(`Logged into "${config.logPath}${config.soundLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
				player.on('end', () => {
					msg.member.voiceChannel.leave();
					console.log(`Disconnected from ${msg.member.voiceChannel.name}!`);
				});
			});
		}
		else{
			msg.reply("join a voice channel first!");
			return;
		};
	};
	if(msg.content.startsWith("!setGame")) {
		if(msg.author.id !== config.ownerID){
			msg.reply("you are not authorized to use this command!");
			console.log(`${msg.author.username}#${msg.author.discriminator} tried to change the bot's game, but failed!`);
			fs.appendFileSync(`${config.logPath}${config.gameChangeLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command, but failed!`);
			console.log(`Logged into "${config.logPath}${config.logName}" ! (${msg.author.username}#${msg.author.discriminator})`);
			return;
		}
		else {
			bot.user.setGame(msg.content.substr(8));
			msg.reply(`successfully set my game to '${msg.content.substr(8)}' !`);
			fs.appendFileSync(`${config.logPath}${config.gameChangeLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`);
			console.log(`Logged into "${config.logPath}${config.gameChangeLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${bot.user.username}'s game set to '${msg.content.substr(8)} ' ! (${msg.author.username}#${msg.author.discriminator})`)
		};
	};
	if(msg.content == "!clearGame") {
		if(msg.author.id !== config.ownerID){
			msg.reply("you are not authorized to use this command!");
			fs.appendFileSync(`${config.logPath}${config.gameChangeLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`);
			console.log(`Logged into "${config.logPath}${config.gameChangeLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${msg.author.username}#${msg.author.discriminator} tried to clear the bot's game, but failed!`);
			return;
		}
		else {
			bot.user.setGame();	
			fs.appendFileSync(`${config.logPath}${config.gameChangeLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`);
			console.log(`Logged into "${config.logPath}${config.gameChangeLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${bot.user.username}'s game status reset! (${msg.author.username}#${msg.author.discriminator})`);
			msg.reply("game status cleared!");
		};
	};
	if(msg.content == "!shutdown") {
		if(msg.author.id !== config.ownerID){
			msg.reply("you are not authorized to use this command!");
			fs.appendFileSync(`${config.logPath}${config.shutdownLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command, but failed!`);
			console.log(`Logged into "${config.logPath}${config.shutdownLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${msg.author.username}#${msg.author.discriminator} tried to shutdown the bot, but failed!`);
			return;
		}
		else {
			msg.reply(`${bot.user.username} shutting down! Bye!`);
			fs.appendFileSync(`${config.logPath}${config.shutdownLog}`, `\n[${moment().format('DD/MM/YYYY H:mm:ss')}] ${msg.author.username}#${msg.author.discriminator} used the "${msg.content}" command!`);
			console.log(`Logged into "${config.logPath}${config.shutdownLog}" ! (${msg.author.username}#${msg.author.discriminator})`);
			console.log(`${bot.user.username} shutting down! (${msg.author.username}#${msg.author.discriminator})`);
			setTimeout(function(){process.exit(0)}, 1500);
		};
	};
});

bot.login(config.token);
{'fraction_non_alphanumeric': 0.22433427519479407, 'fraction_numerical': 0.004794931072865828, 'mean_word_length': 5.239316239316239, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 26, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6727127', 'n_tokens_mistral': 4266, 'n_tokens_neox': 4033, 'n_words': 636}