diff options
Diffstat (limited to 'src/commands/fun')
26 files changed, 970 insertions, 12 deletions
diff --git a/src/commands/fun/clapify.ts b/src/commands/fun/clapify.ts new file mode 100644 index 0000000..f05c768 --- /dev/null +++ b/src/commands/fun/clapify.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class ClapFun extends Command { + constructor(client) { + super(client, { + name: 'clapify', + aliases: ['clap', 'clappify'], + group: 'fun', + memberName: 'clapify', + description: 'Allows you to clapify anything.', + args: [ + { + key: 'say', + prompt: 'What would you like to clapify?', + type: 'string' + } + ], + examples: ['uwu!clapify please clap this lol'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage, { say }) { + msg.say(say.split(' ').join('👏')) + msg.delete() + } +};
\ No newline at end of file diff --git a/src/commands/fun/datefact.ts b/src/commands/fun/datefact.ts new file mode 100644 index 0000000..378aa52 --- /dev/null +++ b/src/commands/fun/datefact.ts @@ -0,0 +1,52 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import axios from 'axios' +import emoji from 'emoji-random' + +module.exports = class DateFactFun extends Command { + constructor(client) { + super(client, { + name: 'datefact', + aliases: [ + 'date-fact', + 'datefacts', + 'date-facts' + ], + group: 'fun', + memberName: 'datefact', + description: 'Grabs facts about a specified date.', + args: [ + { + key: 'day', + prompt: 'What day would you like to get facts for?', + type: 'integer', + max: 31, + min: 1, + default: 'random' + }, + { + key: 'month', + prompt: 'What month would you like to get facts for?', + type: 'integer', + max: 12, + min: 1, + default: 'random' + } + ], + examples: ['uwu!datefact', 'uwu!datefact 12'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage, { day, month }) { + const uri = `http://numbersapi.com/${month === 'random' || day === 'random' ? 'random' : `${month}/${day}`}/date` + const fact = await axios.get(uri).catch(err => { + console.log(err) + msg.reply('Woops, here was an error with the (http://numbersapi.com) API. ' + emoji.random()) + }) + msg.reply(fact.data) + } +};
\ No newline at end of file diff --git a/src/commands/fun/dayfact.ts b/src/commands/fun/dayfact.ts new file mode 100644 index 0000000..f30b828 --- /dev/null +++ b/src/commands/fun/dayfact.ts @@ -0,0 +1,43 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import axios from 'axios' +import emoji from 'emoji-random' + +module.exports = class DayFactFun extends Command { + constructor(client) { + super(client, { + name: 'dayfact', + aliases: [ + 'day-fact', + 'dayfacts', + 'day-facts' + ], + group: 'fun', + memberName: 'dayfact', + description: 'Grabs facts about a specified day.', + args: [ + { + key: 'day', + prompt: 'What day would you like to get facts for?', + type: 'integer', + max: 31, + min: 1, + default: 'random' + } + ], + examples: ['uwu!dayfact', 'uwu!dayfact 12'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage, { day }) { + const fact = await axios.get(`http://numbersapi.com/${day}/date`).catch(err => { + console.log(err) + msg.reply('Woops, here was an error with the (http://numbersapi.com) API. ' + emoji.random()) + }) + msg.reply(fact.data) + } +};
\ No newline at end of file diff --git a/src/commands/fun/drawcards.ts b/src/commands/fun/drawcards.ts new file mode 100644 index 0000000..5d53b72 --- /dev/null +++ b/src/commands/fun/drawcards.ts @@ -0,0 +1,61 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { shuffle } from '../../utils/Util.js' +const suits = ['♣', '♥', '♦', '♠'] +const faces = ['Jack', 'Queen', 'King'] + +module.exports = class DrawCardsFun extends Command { + constructor(client) { + super(client, { + name: 'drawcards', + aliases: [ + 'draw-cards', + 'drawhand', + 'draw-hand' + ], + group: 'fun', + memberName: 'drawcards', + description: 'Draw a hand of playing cards.', + examples: ['uwu!drawcards 5'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'aAmount', + label: 'hand size', + prompt: 'How many cards would you like to draw?', + type: 'integer', + max: 10, + min: 1 + }, + { + key: 'aJokers', + prompt: 'Do you want to include jokers in the draw?', + type: 'boolean', + default: false + } + ], + }); + this.deck = null + } + run(msg: CommandoMessage, { aAmount, aJokers }) { + if (!this.deck) this.deck = this.generateDeck() + let cards = this.deck + if (!aJokers) cards = cards.filter(card => !card.includes('Joker')) + return msg.reply(`${aAmount === 1 ? '' : '\n'}${shuffle(cards).slice(0, aAmount).join('\n')}`) + } + generateDeck() { + const deck = [] + for (const suit of suits) { + deck.push(`${suit} Ace`) + for (let i = 2; i <= 10; i++) deck.push(`${suit} ${i}`) + for (const face of faces) deck.push(`${suit} ${face}`) + } + deck.push('⭐ Joker') + deck.push('⭐ Joker') + return deck + } +};
\ No newline at end of file diff --git a/src/commands/fun/fml.ts b/src/commands/fun/fml.ts new file mode 100644 index 0000000..a3fa600 --- /dev/null +++ b/src/commands/fun/fml.ts @@ -0,0 +1,36 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import request from 'node-superfetch' +import emoji from 'emoji-random' +import cheerio from 'cheerio' + +module.exports = class FMLFun extends Command { + constructor(client) { + super(client, { + name: 'fml', + aliases: [ + 'fuckmylife', + 'fuck-my-life' + ], + group: 'fun', + memberName: 'fml', + description: 'Gives you a random FML.', + examples: ['uwu!fml'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + async run(msg: CommandoMessage) { + try { + const { text } = await request.get('http://www.fmylife.com/random') + const $ = cheerio.load(text, { normalizeWhitespace: true }) + const fml = $('a.article-link').first().text().trim() + return msg.reply(fml + ' ' + emoji.random()) + } catch (err) { + return msg.reply(`Woops, an error has occured: \`${err.message}\`. Try again later! ${emoji.random()}`) + } + } +};
\ No newline at end of file diff --git a/src/commands/fun/githubzen.ts b/src/commands/fun/githubzen.ts new file mode 100644 index 0000000..cc2f0a2 --- /dev/null +++ b/src/commands/fun/githubzen.ts @@ -0,0 +1,35 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import request from 'node-superfetch' +import emoji from 'emoji-random' +import cheerio from 'cheerio' + +module.exports = class GitHubZenFun extends Command { + constructor(client) { + super(client, { + name: 'githubzen', + aliases: [ + 'github-zen', + 'ghzen', + 'gh-zen' + ], + group: 'fun', + memberName: 'githubzen', + description: 'Gives you a random GitHub design philosophy.', + examples: ['uwu!githubzen'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + async run(msg: CommandoMessage) { + try { + const { text } = await request.get('https://api.github.com/zen') + return msg.reply(text + ' ' + emoji.random()) + } catch (err) { + return msg.reply(`Woops, an error has occured: \`${err.message}\`. Try again later! ${emoji.random()}`) + } + } +};
\ No newline at end of file diff --git a/src/commands/fun/howify.ts b/src/commands/fun/howify.ts index a0cbbf5..c1337f9 100644 --- a/src/commands/fun/howify.ts +++ b/src/commands/fun/howify.ts @@ -26,6 +26,7 @@ module.exports = class HowifyFun extends Command { msg.attachments.forEach(async attachment => { var u1 = await how(attachment.url); msg.delete() + msg.reply('Please wait...').then(m => m.delete({ timeout: 2000 })) setTimeout(() => { msg.say({ files: [u1] }) }, 2000); diff --git a/src/commands/fun/iq.ts b/src/commands/fun/iq.ts new file mode 100644 index 0000000..2185878 --- /dev/null +++ b/src/commands/fun/iq.ts @@ -0,0 +1,46 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import { MersenneTwister19937, integer } from 'random-js' + +module.exports = class IQFun extends Command { + constructor(client) { + super(client, { + name: 'iq', + group: 'fun', + memberName: 'iq', + description: 'Tells you your IQ.', + examples: ['uwu!iq'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'uUser', + prompt: 'Which user\'s IQ would you like to guess?', + type: 'user', + default: '' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + let random = MersenneTwister19937.seed(uUser.id) + let iq = integer(20, 270)(random) + if (!uUser) { + msg.reply('Scanning..').then(scanningMsg => { + // @ts-ignore + scanningMsg.delete() + msg.reply(`Your IQ score is **${iq}**. ${emoji.random()}`); + }); + } else { + if (uUser.id === this.client.user.id) { + msg.reply('Me? My IQ is too high for you to even comprehend. ' + emoji.random()) + } else { + msg.reply(`${uUser.username}'s IQ score is **${iq}**. ${emoji.random()}`) + } + } + } +};
\ No newline at end of file diff --git a/src/commands/fun/kissmarrykill.ts b/src/commands/fun/kissmarrykill.ts new file mode 100644 index 0000000..1a7622d --- /dev/null +++ b/src/commands/fun/kissmarrykill.ts @@ -0,0 +1,74 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { shuffle } from '../../utils/Util.js' +import emoji from 'emoji-random' + +module.exports = class KissMarryKillFun extends Command { + constructor(client) { + super(client, { + name: 'kissmarrykill', + aliases: [ + 'kisskillmarry', + 'kiss-kill-marry', + 'killkissmarry', + 'kill-kiss-marry', + 'killmarrykiss', + 'kill-marry-kiss', + 'marrykisskill', + 'marry-kiss-kill', + 'marrykillkiss', + 'marry-kill-kiss', + 'fuck-marry-kill', + 'fuckmarrykill', + 'fuck-kill-marry', + 'fuckkillmarry', + 'kill-fuck-marry', + 'killfuckmarry', + 'kill-marry-fuck', + 'killmarryfuck', + 'marry-fuck-kill', + 'marryfuckkill', + 'marry-kill-fuck', + 'marrykillfuck', + 'kiss-mary-kill' + ], + group: 'fun', + memberName: 'kissmarrykill', + description: 'Kiss Marry Kill.', + examples: ['uwu!kissmarrykill'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'first', + label: 'first name', + prompt: 'Who is the first person you choose?', + type: 'string', + max: 500 + }, + { + key: 'second', + label: 'second name', + prompt: 'Who is the second person you choose?', + type: 'string', + max: 500 + }, + { + key: 'third', + label: 'third name', + prompt: 'Who is the third person you choose?', + type: 'string', + max: 500 + } + ] + }); + } + async run(msg: CommandoMessage, { first, second, third }) { + const kissFuck = msg.channel.nsfw ? 'fuck' : 'kiss'; + const things = shuffle([first, second, third]); + return msg.say(`I'd ${kissFuck} ${things[0]}, marry ${things[1]}, and kill ${things[2]}. ${emoji.random()}`); + } +};
\ No newline at end of file diff --git a/src/commands/fun/numberfact.ts b/src/commands/fun/numberfact.ts new file mode 100644 index 0000000..9e7b698 --- /dev/null +++ b/src/commands/fun/numberfact.ts @@ -0,0 +1,47 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import axios from 'axios' +import emoji from 'emoji-random' + +module.exports = class NumberFactFun extends Command { + constructor(client) { + super(client, { + name: 'numberfact', + aliases: [ + 'number-fact', + 'numberfacts', + 'number-facts', + 'numfact', + 'num-fact', + 'numfacts', + 'num-facts' + ], + group: 'fun', + memberName: 'numberfact', + description: 'Grabs facts about a specified number.', + args: [ + { + key: 'nNum', + prompt: 'What number would you like to get facts for?', + type: 'integer', + max: 31, + min: 1, + default: 'random' + } + ], + examples: ['uwu!numberfact', 'uwu!numberfact 12'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage, { nNum }) { + const fact = await axios.get(`http://numbersapi.com/${nNum}`).catch(err => { + console.log(err) + msg.reply('Woops, here was an error with the (http://numbersapi.com) API. ' + emoji.random()) + }) + msg.reply(fact.data) + } +};
\ No newline at end of file diff --git a/src/commands/fun/cow.ts b/src/commands/fun/offspring.ts index e8fa60b..7152a1c 100644 --- a/src/commands/fun/cow.ts +++ b/src/commands/fun/offspring.ts @@ -1,26 +1,24 @@ import { Command, CommandoMessage } from 'discord.js-commando'; -import cows from 'cows'; +import emoji from 'emoji-random' +const genders = ['boy', 'girl'] -module.exports = class CowFun extends Command { +module.exports = class OffspringFun extends Command { constructor(client) { super(client, { - name: 'cow', - aliases: ['cows'], + name: 'offspring', group: 'fun', - memberName: 'cow', - description: 'Gives you a random cow.', + memberName: 'offspring', + description: 'Determines your child\'s gender.', + examples: ['uwu!offspring'], throttling: { usages: 5, duration: 30 }, - examples: ['uwu!cow', 'uwu!cows'], userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], - clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], }); } run(msg: CommandoMessage) { - let cowNumber = Math.round((Math.random() * cows().length)) - let cow = cows()[cowNumber] - msg.reply(`\`\`\`${cow}\`\`\``); + msg.reply(`It\'s a ${genders[Math.floor(Math.random() * genders.length)]}! ${emoji.random()}`) } };
\ No newline at end of file diff --git a/src/commands/fun/onion.ts b/src/commands/fun/onion.ts new file mode 100644 index 0000000..341b461 --- /dev/null +++ b/src/commands/fun/onion.ts @@ -0,0 +1,36 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { stripIndents } from 'common-tags' +import RSS from 'rss-parser' + +module.exports = class OnionFun extends Command { + constructor(client) { + super(client, { + name: 'onion', + aliases: ['theonion', 'the-onion'], + group: 'fun', + memberName: 'onion', + description: 'Reples with a random Onion article.', + examples: ['uwu!onion'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + async run(msg: CommandoMessage) { + const parser = new RSS() + try { + const feed = await parser.parseURL('https://www.theonion.com/rss') + const article = feed.items[Math.floor(Math.random() * feed.items?.length)] + return msg.reply(stripIndents` + ${article.title} + ${article.link} + `) + } catch (err) { + return msg.reply(`Woops, an error has occurred: \`${err.message}\`. Try again later! ${emoji.random()}`); + } + } +};
\ No newline at end of file diff --git a/src/commands/fun/opinion.ts b/src/commands/fun/opinion.ts new file mode 100644 index 0000000..eada220 --- /dev/null +++ b/src/commands/fun/opinion.ts @@ -0,0 +1,36 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { stripIndents } from 'common-tags' +const opinions = ['👍', '👎'] + +module.exports = class OpinionFun extends Command { + constructor(client) { + super(client, { + name: 'opinion', + group: 'fun', + memberName: 'opinion', + description: 'Determines the bot\'s opinion of a specified thing.', + examples: ['uwu!opinion'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'qQuestion', + prompt: 'What do you want to get an opinion on?', + type: 'string', + max: 1950 + } + ] + }); + } + run(msg: CommandoMessage, { qQuestion }) { + msg.reply(stripIndents` + ${qQuestion} + ${opinions[Math.floor(Math.random() * opinions.length)]} + `) + } +};
\ No newline at end of file diff --git a/src/commands/fun/quantumcoinflip.ts b/src/commands/fun/quantumcoinflip.ts new file mode 100644 index 0000000..3f2446d --- /dev/null +++ b/src/commands/fun/quantumcoinflip.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +const sides = [NaN, 0, null, undefined, '']; + +module.exports = class QuantumCoinFlipFun extends Command { + constructor(client) { + super(client, { + name: 'quantumcoinflip', + aliases: ['quantumflipcoin'], + group: 'fun', + memberName: 'quantumcoinflip', + description: 'Flip a quantum coin.', + throttling: { + usages: 5, + duration: 30 + }, + examples: ['uwu!coinflip', 'uwu!flipcoin'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + var s = sides[Math.floor(Math.random() * sides.length)] + let embed = new MessageEmbed() + + .setAuthor('The quantum coin landed on', 'https://i.imgur.com/pr7JCce.png') + .setDescription('`' + s + '`'); + + msg.say(embed); + } +};
\ No newline at end of file diff --git a/src/commands/fun/randomfacts.ts b/src/commands/fun/randomfacts.ts new file mode 100644 index 0000000..5d9777e --- /dev/null +++ b/src/commands/fun/randomfacts.ts @@ -0,0 +1,66 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import request from 'node-superfetch' +import emoji from 'emoji-random' + +module.exports = class RandomFactFun extends Command { + constructor(client) { + super(client, { + name: 'randomfact', + aliases: [ + 'random-fact', + 'fact', + 'facts' + ], + group: 'fun', + memberName: 'randomfact', + description: 'Gives you a random fact.', + examples: ['uwu!randomfact'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + async run(msg: CommandoMessage) { + try { + const article = await this.randomWikipediaArticle() + const { body } = await request + .get('https://en.wikipedia.org/w/api.php') + .query({ + action: 'query', + prop: 'extracts', + format: 'json', + titles: article, + exintro: '', + explaintext: '', + redirects: '', + formatversion: 2 + }) + let fact = body.query.pages[0].extract; + if (fact.length > 200) { + const facts = fact.split('.'); + fact = `${facts[0]}.`; + if (fact.length < 200 && facts.length > 1) fact += `${facts[1]}.`; + } + return msg.reply(fact + ' ' + emoji.random()); + } catch (err) { + return msg.reply(`Woops, an error has occured: \`${err.message}\`. Try again later! ${emoji.random()}`) + } + } + async randomWikipediaArticle() { + const { body } = await request + .get('https://en.wikipedia.org/w/api.php') + .query({ + action: 'query', + list: 'random', + rnnamespace: 0, + rnlimit: 1, + format: 'json', + formatversion: 2 + }); + if (!body.query.random[0].title) return 'Facts are hard to find sometimes.'; + return body.query.random[0].title; + } +};
\ No newline at end of file diff --git a/src/commands/fun/rate.ts b/src/commands/fun/rate.ts new file mode 100644 index 0000000..0dfc505 --- /dev/null +++ b/src/commands/fun/rate.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' + +module.exports = class RateFun extends Command { + constructor(client) { + super(client, { + name: 'rate', + group: 'fun', + memberName: 'rate', + description: 'Rate something.', + examples: ['uwu!rate deez nuts'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'tThing', + prompt: 'What would you like to rate?', + type: 'string', + max: 1950 + } + ] + }); + } + run(msg: CommandoMessage, { tThing }) { + msg.reply(`I'd give ${tThing} a ${Math.floor(Math.random() * 10) + 1}/10! ${emoji.random()}`) + } +};
\ No newline at end of file diff --git a/src/commands/fun/rolldie.ts b/src/commands/fun/rolldie.ts new file mode 100644 index 0000000..6426238 --- /dev/null +++ b/src/commands/fun/rolldie.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class RollDieFun extends Command { + constructor(client) { + super(client, { + name: 'rolldie', + aliases: ['dice'], + group: 'fun', + memberName: 'rolldie', + description: 'Role a die.', + throttling: { + usages: 5, + duration: 30 + }, + examples: ['uwu!roledie', 'uwu!dice'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + var r = [1, 2, 3, 4, 5, 6]; + var s = r[Math.floor(Math.random() * r.length)]; + let embed = new MessageEmbed() + + .setAuthor('The die landed on', 'https://i.imgur.com/dK18NpV.png') + .setDescription('`' + s + '`'); + + msg.say(embed); + } +};
\ No newline at end of file diff --git a/src/commands/fun/romannumeral.ts b/src/commands/fun/romannumeral.ts new file mode 100644 index 0000000..f7a805f --- /dev/null +++ b/src/commands/fun/romannumeral.ts @@ -0,0 +1,55 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import romanize from 'romanize' + +module.exports = class RomanNumeralFun extends Command { + constructor(client) { + super(client, { + name: 'romannumeral', + aliases: [ + 'roman-numeral', + 'romannumerals', + 'roman-numerals' + ], + group: 'fun', + memberName: 'romannumeral', + description: 'Converts a number to a roman numeral.', + examples: ['uwu!romannumeral 12'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'nNum', + prompt: 'What number would you like to translate', + type: 'integer', + min: 1 + } + ] + }); + } + run(msg: CommandoMessage, { nNum }) { + if (nNum === parseInt(nNum, 10)) { + msg.reply(romanize(nNum)) + } + + const back = value => { + let res = 0 + + const decimal = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] + const roman = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"] + for (let i = 0; i <= decimal.length; i++) { + while (value.indexOf(roman[i]) === 0) { + res += decimal[i] + value = value.replace(roman[i], '') + } + } + return res + } + + msg.reply(back(nNum)) + } +};
\ No newline at end of file diff --git a/src/commands/fun/russianroulette.ts b/src/commands/fun/russianroulette.ts new file mode 100644 index 0000000..ba67118 --- /dev/null +++ b/src/commands/fun/russianroulette.ts @@ -0,0 +1,29 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class RussianRouletteFun extends Command { + constructor(client) { + super(client, { + name: 'russianroulette', + aliases: ['rr'], + group: 'fun', + memberName: 'russianroulette', + description: 'Play a game of Russian Roulette.', + throttling: { + usages: 5, + duration: 30 + }, + examples: ['uwu!russianroulette', 'uwu!rr'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + var s = Math.floor(Math.random() * 6) + if (s === 0) { + return msg.reply('💥 *Bang.* You lose.') + } else { + return msg.reply("🔫 *Click.* You survived."); + } + } +};
\ No newline at end of file diff --git a/src/commands/fun/say.ts b/src/commands/fun/say.ts index 35083d0..e70ad76 100644 --- a/src/commands/fun/say.ts +++ b/src/commands/fun/say.ts @@ -1,5 +1,4 @@ import { Command, CommandoMessage } from 'discord.js-commando'; -import emoji from 'emoji-random'; module.exports = class SayFun extends Command { constructor(client) { diff --git a/src/commands/fun/showerthought.ts b/src/commands/fun/showerthought.ts new file mode 100644 index 0000000..5ee7cb4 --- /dev/null +++ b/src/commands/fun/showerthought.ts @@ -0,0 +1,29 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import SubredditCommand from '../../models/commands/Subreddit.js' + +module.exports = class ShowerThoughtFun extends SubredditCommand { + constructor(client) { + super(client, { + name: 'showerthought', + aliases: [ + 'shower-thought', + 'showerthoughts', + 'shower-thoughts' + ], + group: 'fun', + memberName: 'showerthought', + description: 'Shower thoughts.', + examples: ['uwu!showerthought'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + subreddit: 'Showerthoughts' + }); + } + generateText(post) { + return post.title; + } +};
\ No newline at end of file diff --git a/src/commands/fun/smashorpass.ts b/src/commands/fun/smashorpass.ts new file mode 100644 index 0000000..c6aecbc --- /dev/null +++ b/src/commands/fun/smashorpass.ts @@ -0,0 +1,42 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import { MersenneTwister19937, bool } from 'random-js' + +module.exports = class SmashOrPassFun extends Command { + constructor(client) { + super(client, { + name: 'smashorpass', + aliases: [ + 'smash-or-pass', + 'sop', + 's-o-p' + ], + group: 'fun', + memberName: 'smashorpass', + description: 'Smash or pass.', + examples: ['uwu!sop'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'uUser', + prompt: 'Which user\'s would you like me to check?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + let random = MersenneTwister19937.seed(uUser.id) + let smashOrPass = bool()(random) + if (uUser.id === this.client.user?.id) { + msg.reply(`Obviously smash, Google me. ${emoji.random()}`) + } else { + msg.reply(smashOrPass ? 'Smash, I\'d definetly smash. ' : 'Hard pass. Yuck. ' + emoji.random()) + } + } +};
\ No newline at end of file diff --git a/src/commands/fun/spoiler.ts b/src/commands/fun/spoiler.ts new file mode 100644 index 0000000..4144f48 --- /dev/null +++ b/src/commands/fun/spoiler.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; + +module.exports = class SpoilerFun extends Command { + constructor(client) { + super(client, { + name: 'spoiler', + aliases: ['spoil', 'spoilertext', 'spoiler-text', 'spoiltext', 'spoil-text'], + group: 'fun', + memberName: 'spoiler', + description: 'Turn every character in a specified phrase as a ||spoiler||.', + args: [ + { + key: 'say', + prompt: 'What would you like to spoil?', + type: 'string' + } + ], + examples: ['uwu!spoiler hi lol'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage, { say }) { + msg.say(say.replace(/./g, '||$&||')) + } +};
\ No newline at end of file diff --git a/src/commands/fun/subreddit.ts b/src/commands/fun/subreddit.ts new file mode 100644 index 0000000..a9369d2 --- /dev/null +++ b/src/commands/fun/subreddit.ts @@ -0,0 +1,46 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import SubredditCommandBase from '../../models/commands/Subreddit.js' +import { shorten, formatNumber } from '../../utils/Util.js' +import { MessageEmbed } from 'discord.js'; + +module.exports = class SubredditFun extends SubredditCommandBase { + constructor(client) { + super(client, { + name: 'subreddit', + aliases: ['r/', 'sub', 'reddit'], + patterns: [/^r\/(.+)/i], + group: 'fun', + memberName: 'subreddit', + description: 'Replies with a random post from a specified subreddit.', + args: [ + { + key: 'sSub', + prompt: 'Which subreddit would you like to get a post from?', + type: 'string', + parse: subreddit => encodeURIComponent(subreddit) + } + ], + examples: ['uwu!say hi'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + generateText(post, subreddit, icon) { + const embed = new MessageEmbed() + .setColor(0xFFCC4D) + .setAuthor(`r/${subreddit}`, icon, `https://www.reddit.com/r/${subreddit}/`) + .setTitle(shorten(post.title, 256)) + .setImage(post.post_hint === 'image' ? post.url : null) + .setURL(`https://www.reddit.com${post.permalink}`) + .setTimestamp(post.created_utc * 1000) + .setFooter(`⬆ ${formatNumber(post.score)}`); + if (post.thumbnail && post.thumbnail !== 'self' && post.post_hint !== 'image') { + embed.setThumbnail(post.thumbnail); + } + return embed; + } +};
\ No newline at end of file diff --git a/src/commands/fun/yearfact.ts b/src/commands/fun/yearfact.ts new file mode 100644 index 0000000..8448efc --- /dev/null +++ b/src/commands/fun/yearfact.ts @@ -0,0 +1,41 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import axios from 'axios' +import emoji from 'emoji-random' + +module.exports = class DayFactFun extends Command { + constructor(client) { + super(client, { + name: 'yearfact', + aliases: [ + 'year-fact', + 'yearfacts', + 'year-facts' + ], + group: 'fun', + memberName: 'yearfact', + description: 'Grabs facts about a specified year.', + args: [ + { + key: 'year', + prompt: 'What year would you like to get facts for?', + type: 'integer', + default: 'random' + } + ], + examples: ['uwu!yearfact', 'uwu!yearfact 2012'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage, { year }) { + const fact = await axios.get(`http://numbersapi.com/${year}/year`).catch(err => { + console.log(err) + msg.reply('Woops, here was an error with the (http://numbersapi.com) API. ' + emoji.random()) + }) + msg.reply(fact.data) + } +};
\ No newline at end of file diff --git a/src/commands/fun/yomomma.ts b/src/commands/fun/yomomma.ts new file mode 100644 index 0000000..c0b1743 --- /dev/null +++ b/src/commands/fun/yomomma.ts @@ -0,0 +1,32 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import axios from 'axios' +import { MessageEmbed } from 'discord.js'; +import emoji from 'emoji-random' + +module.exports = class YoMommaFun extends Command { + constructor(client) { + super(client, { + name: 'yomomma', + aliases: ['yo-momma', 'yomama', 'mum', 'mam', 'mom'], + group: 'fun', + memberName: 'yomomma', + description: 'Gives you a yo momma joke.', + examples: ['uwu!yomomma'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage) { + try { + let text = await (await axios.get('http://api.yomomma.info/')).data.joke + msg.reply(`${text}` + ' ' + emoji.random()) + } catch (err) { + console.log(err) + msg.reply('Woops, there was an error with the (https://yomomma.info/) API. ' + emoji.random()) + } + } +};
\ No newline at end of file |