<commit_before>const utils = require('./../../utils.js');

const regex = /(-?\d+)d?(-?\d+)/;

function randInt(d) {
	return Math.floor(Math.random() * d) + 1;
}

module.exports.info = {
	name: 'Dice Roll',
	description: 'Roll a dice or die, with an arbitary number of sides and/or an arbitary number of rolls.',
	category: 'Fun',
	aliases: [
		'roll',
		'die',
		'dice'
	],
	use: [
		{
			name: '',
			value: 'Roll a 6 sided die'
		}, {
			name: '<times>',
			value: 'Roll a 6 sided die the indicated number of times'
		}, {
			name: '<times>d<sides>',
			value: 'Roll an n-sided die the indicated number of times'
		}
	]
};

module.exports.command = function roll(message) {
	const parsed = regex.exec(message.input);
	const rolls = parseInt(parsed[1], 10) || 1;
	const sides = parseInt(parsed[2], 10) || 6;
	const result = [];
	let sum = 0;
	let output = '';

	if (rolls === 0) {
		output += 'Did not roll ';
	} else {
		output += 'Rolled ';
	}

	if (rolls === 1) {
		output += 'a ';
		if (sides === 0) {
			output += 'shape with no sides.';
		} else if (sides === 1) {
			output += 'mobius strip.';
		} else {
			output += `${sides}-sided dice.`;
		}
	} else {
		output += `${rolls} `;
		if (sides === 0) {
			output += 'die with no sides.';
		} else if (sides === 1) {
			output += 'mobius strips.';
		} else {
			output += `${sides}-sided die.`;
		}
	}<commit_msg>Check if not NAN<commit_after>const utils = require('./../../utils.js');

const regex = /(-?\d+)d?(-?\d+)/;

function randInt(d) {
	return Math.floor(Math.random() * d) + 1;
}

module.exports.info = {
	name: 'Dice Roll',
	description: 'Roll a dice or die, with an arbitary number of sides and/or an arbitary number of rolls.',
	category: 'Fun',
	aliases: [
		'roll',
		'die',
		'dice'
	],
	use: [
		{
			name: '',
			value: 'Roll a 6 sided die'
		}, {
			name: '<times>',
			value: 'Roll a 6 sided die the indicated number of times'
		}, {
			name: '<times>d<sides>',
			value: 'Roll an n-sided die the indicated number of times'
		}
	]
};

module.exports.command = function roll(message) {
	const parsed = regex.exec(message.input);
	const rolls = !isNaN(parseInt(parsed[1], 10)) ? parseInt(parsed[1], 10) : 1;
	const sides = !isNaN(parseInt(parsed[2], 10)) ? parseInt(parsed[2], 10) : 6;
	const result = [];
	let sum = 0;
	let output = '';

	if (rolls === 0) {
		output += 'Did not roll ';
	} else {
		output += 'Rolled ';
	}

	if (rolls === 1) {
		output += 'a ';
		if (sides === 0) {
			output += 'shape with no sides.';
		} else if (sides === 1) {
			output += 'mobius strip.';
		} else {
			output += `${sides}-sided dice.`;
		}
	} else {
		output += `${rolls} `;
		if (sides === 0) {
			output += 'die with no sides.';
		} else if (sides === 1) {
			output += 'mobius strips.';
		} else {
			output += `${sides}-sided die.`;
		}
	}
{'fraction_non_alphanumeric': 0.20306376914855717, 'fraction_numerical': 0.014962593516209476, 'mean_word_length': 2.8784530386740332, 'pattern_counts': {'":': 0, '<': 9, '<?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': '2343378', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1085, 'n_words': 311}