<commit_before>const discord = require('discord.js')
const fs      = require('fs')
const db      = require('./modules/database.js')

const client = new discord.Client()
client.config   = require('./config.json')
client.commands = new Map();

client.on('ready', () => {
	if(!client.config.prefix) client.config.prefix = '<@${client.user.id}> '
	delete client.config.token

	// TODO: Conflict detector for command name and aliases?
	fs.readdirSync('./commands').forEach(file => {
		const construct = require(`./commands/${file}`)
		const command   = new construct();

		client.commands.set(command.constructor.name, command)
		command.aliases.forEach(alias => {
			client.commands.set(alias, command)
		})
	})
});

client.on('message', (msg) => {
	if(msg.author.id == client.user.id)
	if(!msg.content.startsWith(client.config.prefix)) return

	const args = msg.content.slice(client.config.prefix.length).split(" ");
	const cmd = args.shift()

	const command = client.commands.get(cmd)
	if(!command) return

	if(command.disableDMs && msg.channel.type == 'dm') {
		msg.reply(typeof command.disableDMs === 'string' ? command.disableDMs : "This command is disabled in DMs.")
		return
	}

	try {
		command.execute(msg, args);
	} catch(e) {
		console.warn(e)
		msg.reply('An unknown error occurred.')
	}
});

client.on('debug', console.log)
client.on('error', console.error)
client.on('warn', console.warn)
client.on('disconnect', console.warn)

client.login(client.config.token)<commit_msg>Make default dm disabled message more verbose<commit_after>const discord = require('discord.js')
const fs      = require('fs')
const db      = require('./modules/database.js')

const client = new discord.Client()
client.config   = require('./config.json')
client.commands = new Map();

client.on('ready', () => {
	if(!client.config.prefix) client.config.prefix = '<@${client.user.id}> '
	delete client.config.token

	// TODO: Conflict detector for command name and aliases?
	fs.readdirSync('./commands').forEach(file => {
		const construct = require(`./commands/${file}`)
		const command   = new construct();

		client.commands.set(command.constructor.name, command)
		command.aliases.forEach(alias => {
			client.commands.set(alias, command)
		})
	})
});

client.on('message', (msg) => {
	if(msg.author.id == client.user.id)
	if(!msg.content.startsWith(client.config.prefix)) return

	const args = msg.content.slice(client.config.prefix.length).split(" ");
	const cmd = args.shift()

	const command = client.commands.get(cmd)
	if(!command) return

	if(command.disableDMs && msg.channel.type == 'dm') {
		msg.reply(typeof command.disableDMs === 'string' ?
			command.disableDMs : "This command is disabled in direct messages.")
		return
	}

	try {
		command.execute(msg, args);
	} catch(e) {
		console.warn(e)
		msg.reply('An unknown error occurred.')
	}
});

client.on('debug', console.log)
client.on('error', console.error)
client.on('warn', console.warn)
client.on('disconnect', console.warn)

client.login(client.config.token)
{'fraction_non_alphanumeric': 0.17524062396282775, 'fraction_numerical': 0.0, 'mean_word_length': 4.391771019677996, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '3029480', 'n_tokens_mistral': 1005, 'n_tokens_neox': 961, 'n_words': 194}