finishing off the fun commands

This commit is contained in:
rhearmas 2019-12-22 22:22:04 -05:00
parent d69a7d971a
commit 3865dd9059
11 changed files with 520 additions and 0 deletions

32
commands/Fun/fliptext.js Normal file
View file

@ -0,0 +1,32 @@
const mapping = '¡"#$%⅋,)(*+\'-˙/0ƖᄅƐㄣϛ9ㄥ86:;<=>?@∀qƆpƎℲפHIſʞ˥WNOԀQɹS┴∩ΛMX⅄Z[/]^_`ɐqɔpǝɟƃɥᴉɾʞlɯuodbɹsʇnʌʍxʎz{|}~';
const OFFSET = '!'.charCodeAt(0);
exports.run = async (client, message, args, level) => {
if (args.length < 1) {
message.delete();
message.reply("you didn't specify any text for me to flip!").delete(5000);
}
message.delete();
message.channel.send(
args.join(' ').split('')
.map(c => c.charCodeAt(0) - OFFSET)
.map(c => mapping[c] || ' ')
.reverse().join('')
);
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: ["flip"],
permLevel: "User"
};
exports.help = {
name: "fliptext",
category: "Fun",
description: "Flips text upside down!",
usage: "fliptext <text>"
};

22
commands/Fun/initial.js Normal file
View file

@ -0,0 +1,22 @@
exports.run = async (client, message, args, level) => {
if (!args[0]) {
message.delete();
return (await message.reply("you must input some text to be transformed.")).delete(5000);
}
message.delete();
message.channel.send(args.map(arg => arg[0].toUpperCase() + arg.slice(1).toLowerCase()).join(' '));
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "initial",
category: "Fun",
description: "Transforms the text you insert into Initial Caps.",
usage: "initial <text>"
};

46
commands/Fun/jumbo.js Normal file
View file

@ -0,0 +1,46 @@
exports.run = async (client, message, args, level) => {
if (args.length < 1) {
message.delete();
return (await message.reply("you didn't provide an emoji to enlarge.")).delete(5000);
}
if (args[0].charCodeAt(0) >= 55296) {
message.delete();
return (await message.reply("I can't enlarge Discord's built-in emoji.")).delete(5000);
}
const match = args[0].match(/<:[a-zA-Z0-9_-]+:(\d{18})>/);
if (!match || !match[1]) {
message.delete();
return (await message.reply("please provide a valid emoji.")).delete(5000);
}
const emoji = client.emojis.get(match[1]);
if (!emoji) {
message.delete();
return (await message.reply("I couldn't identify that emoji.")).delete(5000);
}
message.delete();
message.channel.send({
files: [
emoji.url
]
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "jumbo",
category: "Fun",
description: "Enlarges an emoji.",
usage: "jumbo <emoji>"
};

100
commands/Fun/leet.js Normal file
View file

@ -0,0 +1,100 @@
let _inverseReplacementsCached = null;
const getInverseReplacements = replacements => {
if (_inverseReplacementsCached) {
return _inverseReplacementsCached;
}
const inverseReplacements = new Map();
Object.keys(replacements)
.map(letter => {
replacements[letter].forEach(replacement => {
inverseReplacements.set(new RegExp(global.utils.quoteRegex(replacement), 'gi'), letter);
});
});
_inverseReplacementsCached = inverseReplacements;
return inverseReplacements;
};
exports.run = async (client, message, args, level) => {
const parsedArgs = client.parseArgs(args, ['e', 't']);
if (parsedArgs.leftover.length < 1) {
message.delete();
return (await message.reply("please provide some text to convert.")).delete(5000);
}
let parsed;
if (parsedArgs.options.e) {
const extendedLeetReplacements = {
'a': ['4', '@', '/-\\', 'Д'],
'b': ['ß'],
'c': ['¢', '©'],
'e': ['3', '€'],
'f': ['ph', 'ƒ'],
'g': ['6'],
'i': ['1', '!'],
'l': ['7'],
'n': ['И', 'ท'],
'q': ['Ø'],
'r': ['®', 'Я'],
's': ['5', '$', '§'],
't': ['†'],
'u': ['|_|', 'µ', 'บ'],
'v': ['\\/'],
'w': ['\\/\\/', 'VV', 'Ш', 'พ'],
'x': ['Ж', '×'],
'y': ['¥']
};
const inverseReplacements = getInverseReplacements(extendedLeetReplacements);
if (parsedArgs.options.t) {
parsed = parsedArgs.leftover.join(' ');
for (let [replacement, origValue] of inverseReplacements) {
parsed = parsed.replace(replacement, origValue);
}
} else {
parsed = parsedArgs.leftover
.join(' ')
.replace(/[a-z]/gi, str => {
let selection = client.randomSelection(extendedLeetReplacements[str.toLowerCase()] || [str]);
selection = client.quoteRegex(selection);
return selection;
});
}
} else {
const simpleLeetReplacements = '4BCD3F6H1JKLMN0PQR57';
if (parsedArgs.options.t) {
parsed = parsedArgs.leftover.join(' ').replace(/[a-z0-9]/g, function (a) {
let foundInReplacements = simpleLeetReplacements.indexOf(a);
if (foundInReplacements === -1) {
return a;
}
return String.fromCharCode(97 + foundInReplacements);
});
} else {
parsed = parsedArgs.leftover.join(' ').replace(/[a-z]/g, function f(a) {
return simpleLeetReplacements[parseInt(a, 36) - 10] || a.replace(/[a-t]/gi, f);
}).toLowerCase();
}
}
message.delete();
message.channel.send(parsed);
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "leet",
category: "Fun",
description: "Talk like a true gamer.",
usage: "leet <text>"
};

22
commands/Fun/reverse.js Normal file
View file

@ -0,0 +1,22 @@
exports.run = async (client, message, args, level) => {
if (args.length < 1) {
message.delete();
return (await message.reply("text")).delete(5000);
}
message.delete();
message.channel.send(args.join(' ').split('').reverse().join(''));
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "reverse",
category: "Fun",
description: "Reverses the text you insert.",
usage: "reverse <text>"
};

49
commands/Fun/roll.js Normal file
View file

@ -0,0 +1,49 @@
const Roll = require('roll');
const roller = new Roll();
exports.run = async (client, message, args, level) => {
if (!args[0]) {
message.delete();
return (await message.reply("you must specify in dice notation (XdY).")).delete(5000);
}
let reason = '';
let footer = '';
footer += `:game_die: **${args[0]}**`;
if (args.length > 1) {
reason = args.splice(1).join(' ');
footer += ` | ${reason}`;
}
let results = roller.roll(args[0]);
message.delete();
let embed = client.embed(
`Total: ${results.result}`,
`${[].concat.apply([], results.rolled).join(', ').substr(0, 1800)}`,
[
{
name: '\u200b',
value: footer
}
]
);
message.channel.send({ embed });
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "roll",
category: "Fun",
description: "Rolls X dice with Y sides. Supports standard dice notation.",
usage: "roll <XdY> [reason]"
};

60
commands/Fun/shoot.js Normal file
View file

@ -0,0 +1,60 @@
const responses = [
'is on a killing spree!',
'just shot someone!',
'murdered an innocent! Grab the sherrif!',
'got a bullseye.',
'wrangled a person!',
'made someone get got!',
'brought a gun to a knife fight.',
'earned someone a closed-casket funeral.',
'shot a weeb!',
'pumped up some kicks!'
];
const critResponses = [
'GOT A HEADSHOT!!',
'HIT A 360 NOSCOPE!!!!',
'EXPLODED A CORPSE WITH A BULLET!!',
'HAS LUCK ON THEIR SIDE!!',
'SENT SOMEONE FLYING HOME!!!!'
];
function randomItem(array) {
return array[Math.floor(Math.random() * array.length)];
}
exports.run = async (client, message, args, level) => {
if (message.mentions.users.size < 1) {
message.delete();
return (await message.reply("gotta mention those people you wanna shoot, ya know.")).delete(5000);
}
let response = randomItem(responses);
let crit = Math.floor(Math.random() * 10);
// console.log(`crit is ${crit}`)
if(crit === 1) {
response = randomItem(critResponses);
}
let output = message.mentions.users.map(m => `**${m}** ${crit === 1 ? ':skull:' : ''}:boom::gun: **${message.author}**`).join('\n');
message.delete();
message.channel.send({
embed: client.embed(`${crit === 1 ? message.author.username.toUpperCase() : message.author.username} ${response}`, output)
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "shoot",
category: "Fun",
description: "Shoots yer friendz!",
usage: "shoot <mention>"
};

33
commands/Fun/sigh.js Normal file
View file

@ -0,0 +1,33 @@
const ascii = `
\`\`\`
_______ _________ _________ , ,
/ | / | |
| | | | |
| | | | |
\\_____, | | _______, |________|
\\ | | | | |
| | | | | |
| | | | | |
______/ ____|____ \\________| | |
\u200b
\`\`\`
`;
exports.run = async (client, message, args, level) => {
message.delete();
message.channel.send(ascii);
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "sigh",
category: "Fun",
description: "Siiiiggggghhh...",
usage: "sigh"
};

32
commands/Fun/space.js Normal file
View file

@ -0,0 +1,32 @@
exports.run = async (client, message, args, level) => {
if(!args[0]) {
message.delete();
return (await message.reply("you didn't provide any text to space out!")).delete(5000);
}
let amount = 2;
if(!isNaN(args[0])) {
amount = parseInt(args[0]);
(amount < 1) && (amount = 1);
(amount > 15) && (amount = 15);
args = args.slice(1);
}
message.delete();
message.channel.send(args.join(' '.repeat(amount / 2)).split('').join(' '.repeat(amount)));
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "space",
category: "Fun",
description: "Spaces out text to look all dramatic n' stuff.",
usage: "space [amount] <text>"
};

66
commands/Fun/tiny.js Normal file
View file

@ -0,0 +1,66 @@
const mappings = (function (object) {
let output = [];
for (let key in object) {
output.push({
regex: new RegExp(key, 'ig'),
replacement: object[key]
});
}
return output;
})({
a: '\u1D00',
b: '\u0299',
c: '\u1D04',
d: '\u1D05',
e: '\u1D07',
f: '\uA730',
g: '\u0262',
h: '\u029C',
i: '\u026A',
j: '\u1D0A',
k: '\u1D0B',
l: '\u029F',
m: '\u1D0D',
n: '\u0274',
o: '\u1D0F',
p: '\u1D18',
q: '\u0071',
r: '\u0280',
s: '\uA731',
t: '\u1D1B',
u: '\u1D1C',
v: '\u1D20',
w: '\u1D21',
x: '\u0078',
y: '\u028F',
z: '\u1D22'
});
exports.run = async (client, message, args, level) => {
if (!args[0]) {
message.delete();
return (await message.reply("you must provide some text to shrink!")).delete(5000);
}
let output = args.join(' ');
mappings.forEach(replacer => output = output.replace(replacer.regex, replacer.replacement));
message.delete();
message.channel.send(output);
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "tiny",
category: "Fun",
description: "Super tiny text!",
usage: "tiny <text>"
};

58
commands/Fun/xkcd.js Normal file
View file

@ -0,0 +1,58 @@
const got = require('got');
async function getInfo(id) {
return (await got(`http://xkcd.com/${id}/info.0.json`, { json: true })).body;
}
async function getLatest() {
return (await got('http://xkcd.com/info.0.json', { json: true })).body;
}
async function getRandom() {
const latest = await getLatest();
const max = latest.num;
return Math.floor(Math.random() * max);
}
exports.run = async (client, message, args, level) => {
let id;
if (args[0] === 'latest') {
id = (await getLatest()).num;
} else {
id = parseInt(args[0]);
if (isNaN(id)) {
id = await getRandom();
}
}
while (id === 404) {
id = await getRandom();
}
const info = await getInfo(id);
message.delete();
message.channel.send({
embed: client.embed(`[${id}] ${info.title}`, '', [], {
image: info.img,
color: [150, 168, 199],
url: `http://xkcd.com/${id}`
}).setFooter(info.alt)
});
};
exports.conf = {
enabled: true,
guildOnly: false,
aliases: [],
permLevel: "User"
};
exports.help = {
name: "xkcd",
category: "Fun",
description: "Fetches random or specific XKCD comics.",
usage: "xkcd [latest|<id>]"
};