diff options
| author | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-07-23 23:24:17 -0700 |
| commit | bb511abc03bb66848947e37a999502b813c77269 (patch) | |
| tree | 612c010fc8317e1cdf11471a18aad0270819d33e /server/src/commands/fun | |
| parent | fix: if clear amount equal or over 100, round down to 99 (diff) | |
| download | dep-core-bb511abc03bb66848947e37a999502b813c77269.tar.xz dep-core-bb511abc03bb66848947e37a999502b813c77269.zip | |
goodbye old uwufier :cry:
Diffstat (limited to 'server/src/commands/fun')
| -rw-r--r-- | server/src/commands/fun/Advice.ts | 29 | ||||
| -rw-r--r-- | server/src/commands/fun/Clapify.ts | 39 | ||||
| -rw-r--r-- | server/src/commands/fun/DateFact.ts | 52 | ||||
| -rw-r--r-- | server/src/commands/fun/DayFact.ts | 41 | ||||
| -rw-r--r-- | server/src/commands/fun/FML.ts | 33 | ||||
| -rw-r--r-- | server/src/commands/fun/Fact | 67 | ||||
| -rw-r--r-- | server/src/commands/fun/GitHubZen.ts | 29 | ||||
| -rw-r--r-- | server/src/commands/fun/Hello.ts | 23 | ||||
| -rw-r--r-- | server/src/commands/fun/Insult.ts | 29 | ||||
| -rw-r--r-- | server/src/commands/fun/NumberFact.ts | 41 | ||||
| -rw-r--r-- | server/src/commands/fun/Onion.ts | 35 | ||||
| -rw-r--r-- | server/src/commands/fun/Opinion.ts | 34 | ||||
| -rw-r--r-- | server/src/commands/fun/PayRespects.ts | 24 | ||||
| -rw-r--r-- | server/src/commands/fun/Rate.ts | 33 | ||||
| -rw-r--r-- | server/src/commands/fun/Say.ts | 40 | ||||
| -rw-r--r-- | server/src/commands/fun/Spoiler.ts | 39 | ||||
| -rw-r--r-- | server/src/commands/fun/Uwufy.ts | 48 | ||||
| -rw-r--r-- | server/src/commands/fun/YearFact.ts | 41 | ||||
| -rw-r--r-- | server/src/commands/fun/YoMomma.ts | 29 |
19 files changed, 706 insertions, 0 deletions
diff --git a/server/src/commands/fun/Advice.ts b/server/src/commands/fun/Advice.ts new file mode 100644 index 0000000..17035c0 --- /dev/null +++ b/server/src/commands/fun/Advice.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class AdviceFun extends Command { + public constructor() { + super('advice', { + aliases: ['advice'], + category: 'fun', + description: { + content: 'Gives you a random piece of advice.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const response = await Axios.get('http://api.adviceslip.com/advice').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(response.data.slip.advice); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Clapify.ts b/server/src/commands/fun/Clapify.ts new file mode 100644 index 0000000..3e6e0fd --- /dev/null +++ b/server/src/commands/fun/Clapify.ts @@ -0,0 +1,39 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class ClapifyFun extends Command { + public constructor() { + super('clapify', { + aliases: ['clapify'], + category: 'fun', + description: { + content: 'Clapifies your specified text.', + usage: '[text]', + examples: [ + 'clap this lol' + ] + }, + ratelimit: 3, + args: [ + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to clapify?' + }, + match: 'rest' + }, + { + id: 'deleteinitialmessage', + flag: ['-delete', '-d'], + match: 'flag' + } + ] + }); + } + + public exec(msg: Message, { text, deleteinitialmessage }): Promise<Message> { + if (deleteinitialmessage) msg.delete(); + return msg.channel.send(text.split(' ').join('👏')); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/DateFact.ts b/server/src/commands/fun/DateFact.ts new file mode 100644 index 0000000..6fe94bc --- /dev/null +++ b/server/src/commands/fun/DateFact.ts @@ -0,0 +1,52 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class DateFactFun extends Command { + public constructor() { + super('datefact', { + aliases: ['datefact'], + category: 'fun', + description: { + content: 'Grabs a fact about a specified date.', + usage: '[numeric day] [numeric month]', + examples: [ + '8 4' + ] + }, + ratelimit: 3, + args: [ + { + id: 'day', + type: 'integer', + prompt: { + start: 'What day would you like to get facts for? (Numeric value)', + retry: 'That is not a valid day, please try again.', + retries: 3 + }, + default: 'random', + }, + { + id: 'month', + type: 'integer', + prompt: { + start: 'What month would you like to get facts for? (Numeric value)', + retry: 'That is not a valid month, please try again.', + retries: 3 + }, + default: 'random', + } + ] + }); + } + + public async exec(msg: Message, { day, month }): Promise<Message> { + const uri = `http://numbersapi.com/${month === 'random' || day === 'random' ? 'random' : `${month}/${day}/date`}`; + const fact = await Axios.get(uri).catch(err => { + console.error(err); + return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(fact.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/DayFact.ts b/server/src/commands/fun/DayFact.ts new file mode 100644 index 0000000..df5d3b7 --- /dev/null +++ b/server/src/commands/fun/DayFact.ts @@ -0,0 +1,41 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class DayFactFun extends Command { + public constructor() { + super('dayfact', { + aliases: ['dayfact'], + category: 'fun', + description: { + content: 'Grabs a fact about a specified day.', + usage: '[numeric day]', + examples: [ + '8' + ] + }, + ratelimit: 3, + args: [ + { + id: 'day', + type: 'integer', + prompt: { + start: 'What day would you like to get facts for? (Numeric value)', + retry: 'That is not a valid day, please try again.', + retries: 3 + }, + default: 'random', + } + ] + }); + } + + public async exec(msg: Message, { day }): Promise<Message> { + const fact = await Axios.get(`http://numbersapi.com/${day}/date`).catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(fact.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/FML.ts b/server/src/commands/fun/FML.ts new file mode 100644 index 0000000..041622c --- /dev/null +++ b/server/src/commands/fun/FML.ts @@ -0,0 +1,33 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import request from 'node-superfetch'; +import * as cheerio from 'cheerio'; + +export default class FMLFun extends Command { + public constructor() { + super('fml', { + aliases: ['fml'], + category: 'fun', + description: { + content: 'Gives you a random FML.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + //@ts-ignore + const { text } = await request.get('http://www.fmylife.com/random').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://www.fmylife.com/random) API.'); + }); + const $ = cheerio.load(text, { normalizeWhitespace: true }); + const fml = $('a.article-link').first().text().trim(); + //@ts-ignore + return msg.reply(fml); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Fact b/server/src/commands/fun/Fact new file mode 100644 index 0000000..c942b45 --- /dev/null +++ b/server/src/commands/fun/Fact @@ -0,0 +1,67 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import request from 'node-superfetch'; + +export default class FactFun extends Command { + public constructor() { + super('fact', { + aliases: ['fact', 'facts'], + category: 'fun', + description: { + content: 'Grabs a random fact.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + 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: '', + //@ts-ignore + formatversion: 2 + }) + .catch(err => { + console.error(err); + msg.reply('Woops, there was an error regarding the (http://en.wikipedia.org) API.'); + }); + //@ts-ignore + 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); + } + + public async randomWikipediaArticle() { + const { body } = await request.get('https://en.wikipedia.org/w/api.php') + .query({ + action: 'query', + list: 'random', + //@ts-ignore + rnnamespace: 0, + //@ts-ignore + rnlimit: 1, + format: 'json', + //@ts-ignore + formatversion: 2 + }); + //@ts-ignore + if (!body.query.random[0].title) return 'Facts are hard to find sometimes.'; + //@ts-ignore + return body.query.random[0].title; + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/GitHubZen.ts b/server/src/commands/fun/GitHubZen.ts new file mode 100644 index 0000000..a1ffeee --- /dev/null +++ b/server/src/commands/fun/GitHubZen.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class GitHubZenFun extends Command { + public constructor() { + super('githubzen', { + aliases: ['githubzen', 'github-zen'], + category: 'fun', + description: { + content: 'Gives you a random GitHub design philosophy.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const text = await Axios.get('https://api.github.com/zen').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://api.github.com) API.'); + }); + //@ts-ignore + return msg.reply(text.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Hello.ts b/server/src/commands/fun/Hello.ts new file mode 100644 index 0000000..a866d39 --- /dev/null +++ b/server/src/commands/fun/Hello.ts @@ -0,0 +1,23 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class HelloFun extends Command { + public constructor() { + super('hello', { + aliases: ['hello', 'hi'], + category: 'fun', + description: { + content: 'Say hello!', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message> { + return msg.reply('Hi!'); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Insult.ts b/server/src/commands/fun/Insult.ts new file mode 100644 index 0000000..941824f --- /dev/null +++ b/server/src/commands/fun/Insult.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class InsultFun extends Command { + public constructor() { + super('insult', { + aliases: ['insult', 'roast', 'roastwilly'], + category: 'fun', + description: { + content: 'Gives you a random insult.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const response = await Axios.get('https://evilinsult.com/generate_insult.php?lang=en&type=json').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(response.data.insult); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/NumberFact.ts b/server/src/commands/fun/NumberFact.ts new file mode 100644 index 0000000..2739218 --- /dev/null +++ b/server/src/commands/fun/NumberFact.ts @@ -0,0 +1,41 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class NumberFactFun extends Command { + public constructor() { + super('numberfact', { + aliases: ['numberfact', 'number-fact', 'numfact', 'num-fact'], + category: 'fun', + description: { + content: 'Grabs a facts about a specified number.', + usage: '[number]', + examples: [ + '8' + ] + }, + ratelimit: 3, + args: [ + { + id: 'number', + type: 'integer', + prompt: { + start: 'What number would you like to get facts for? (Numeric value)', + retry: 'That is not a valid number, please try again.', + retries: 3 + }, + default: 'random', + } + ] + }); + } + + public async exec(msg: Message, { number }): Promise<Message> { + const fact = await Axios.get(`http://numbersapi.com/${number}`).catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(fact.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Onion.ts b/server/src/commands/fun/Onion.ts new file mode 100644 index 0000000..e056ec7 --- /dev/null +++ b/server/src/commands/fun/Onion.ts @@ -0,0 +1,35 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { stripIndents } from 'common-tags'; +import RSS from 'rss-parser'; + +export default class OnionFun extends Command { + public constructor() { + super('onion', { + aliases: ['onion', 'theonion', 'the-onion'], + category: 'fun', + description: { + content: 'Gives you a random Onion article.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const parser = new RSS(); + const feed = await parser.parseURL('https://www.theonion.com/rss').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error regarding the (http://numbersapi.com) API.'); + }); + //@ts-ignore + const article = feed.items[Math.floor(Math.random() * feed.items.length)]; + return msg.reply(stripIndents` + ${article.title} + ${article.link} + `); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Opinion.ts b/server/src/commands/fun/Opinion.ts new file mode 100644 index 0000000..012af7e --- /dev/null +++ b/server/src/commands/fun/Opinion.ts @@ -0,0 +1,34 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class OpinionFun extends Command { + public constructor() { + super('opinion', { + aliases: ['opinion'], + category: 'fun', + description: { + content: 'Determines the bot\'s opinion on something. WARNING: do not take these seriously.', + usage: '[question]', + examples: [ + 'avocadoes' + ] + }, + ratelimit: 3, + args: [ + { + id: 'question', + type: 'string', + prompt: { + start: 'What would you like to get an opinion on?' + }, + match: 'rest' + } + ] + }); + } + + public exec(msg: Message, { question }): Promise<Message> { + const opinions = ['👍', '👎']; + return msg.reply(`*${question}* ${opinions[Math.floor(Math.random() * opinions.length)]}`); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/PayRespects.ts b/server/src/commands/fun/PayRespects.ts new file mode 100644 index 0000000..a7c9c68 --- /dev/null +++ b/server/src/commands/fun/PayRespects.ts @@ -0,0 +1,24 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { MessageReaction } from 'discord.js'; + +export default class PayRespectsFun extends Command { + public constructor() { + super('payrespects', { + aliases: ['payrespects', 'respect', 'f'], + category: 'fun', + description: { + content: 'Press F to pay respects.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise<Message | MessageReaction> { + return msg.channel.send('Press F to pay respects').then(m => m.react('🇫')); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Rate.ts b/server/src/commands/fun/Rate.ts new file mode 100644 index 0000000..d377c11 --- /dev/null +++ b/server/src/commands/fun/Rate.ts @@ -0,0 +1,33 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class RateFun extends Command { + public constructor() { + super('rate', { + aliases: ['rate'], + category: 'fun', + description: { + content: 'Determines the bot\'s rating on something. WARNING: do not take these seriously.', + usage: '[question/ item/ topic]', + examples: [ + 'avocadoes' + ] + }, + ratelimit: 3, + args: [ + { + id: 'item', + type: 'string', + prompt: { + start: 'What would you like to get a rating on?' + }, + match: 'rest' + } + ] + }); + } + + public exec(msg: Message, { item }): Promise<Message> { + return msg.reply(`I'd give *${item}* a rating of **${Math.floor(Math.random() * 10) + 1}/ 10**!`); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Say.ts b/server/src/commands/fun/Say.ts new file mode 100644 index 0000000..876f539 --- /dev/null +++ b/server/src/commands/fun/Say.ts @@ -0,0 +1,40 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { validIDs, owners } from '../../Config'; + +export default class SayFun extends Command { + public constructor() { + super('say', { + aliases: ['say'], + category: 'fun', + description: { + content: 'Allows you to speak as the bot.', + usage: '[text]', + examples: [ + 'hi this is bot' + ] + }, + ratelimit: 3, + args: [ + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to say?' + }, + match: 'rest' + } + ] + }); + } + + public exec(msg: Message, { text }): Promise<Message> { + console.log(text) + if (validIDs.includes(msg.author.id) || owners.includes(msg.author.id)) { + msg.delete(); + return msg.channel.send(text); + } + + return msg.delete(); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Spoiler.ts b/server/src/commands/fun/Spoiler.ts new file mode 100644 index 0000000..fb061f9 --- /dev/null +++ b/server/src/commands/fun/Spoiler.ts @@ -0,0 +1,39 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class SpoilerFun extends Command { + public constructor() { + super('spoiler', { + aliases: ['spoiler'], + category: 'fun', + description: { + content: 'Turn every character in a specified phrase as a ||s||||p||||o||||i||||l||||e||||r||.', + usage: '[text]', + examples: [ + 'hide this lol' + ] + }, + ratelimit: 3, + args: [ + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to *spoil* (hide)?' + }, + match: 'rest' + }, + { + id: 'deleteinitialmessage', + flag: ['-delete', '-d'], + match: 'flag' + } + ] + }); + } + + public exec(msg: Message, { text, deleteinitialmessage }): Promise<Message> { + if (deleteinitialmessage) msg.delete(); + return msg.channel.send(text.replace(/./g, '||$&||')); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/Uwufy.ts b/server/src/commands/fun/Uwufy.ts new file mode 100644 index 0000000..15aff06 --- /dev/null +++ b/server/src/commands/fun/Uwufy.ts @@ -0,0 +1,48 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; + +export default class UwufyFun extends Command { + public constructor() { + super('uwufy', { + aliases: ['uwufy', 'owofy'], + category: 'fun', + description: { + content: 'Uwufys a specified string.', + usage: '[text]', + examples: [ + 'how are you doing today?' + ] + }, + ratelimit: 3, + args: [ + { + id: 'text', + type: 'string', + prompt: { + start: 'What would you like to uwufy?' + }, + match: 'rest' + }, + { + id: 'deleteinitialmessage', + flag: ['-delete', '-d'], + match: 'flag' + } + ] + }); + } + + public exec(msg: Message, { text, deleteinitialmessage }): Promise<Message> { + if (deleteinitialmessage) msg.delete(); + text.replace(/(?:l|r)/g, 'w'); + text.replace(/(?:L|R)/g, 'W'); + text.replace(/!+/g, ` >w< `); + + const f = (Math.random() < 0.25) + if (f) { + let c = text.charAt(0); + text = c + '-' + text + } + return msg.channel.send(`*${text}*`); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/YearFact.ts b/server/src/commands/fun/YearFact.ts new file mode 100644 index 0000000..e6b2208 --- /dev/null +++ b/server/src/commands/fun/YearFact.ts @@ -0,0 +1,41 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class YearFactFun extends Command { + public constructor() { + super('yearfact', { + aliases: ['yearfact'], + category: 'fun', + description: { + content: 'Grabs a fact about a specified year.', + usage: '[numeric year]', + examples: [ + '1995' + ] + }, + ratelimit: 3, + args: [ + { + id: 'year', + type: 'integer', + prompt: { + start: 'What year would you like to get facts for? (Numeric value)', + retry: 'That is not a valid year, please try again.', + retries: 3 + }, + default: 'random', + } + ] + }); + } + + public async exec(msg: Message, { year }): Promise<Message> { + const fact = await Axios.get(`http://numbersapi.com/${year}/year`).catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (http://numbersapi.com) API.'); + }); + //@ts-ignore + return msg.reply(fact.data); + } +}
\ No newline at end of file diff --git a/server/src/commands/fun/YoMomma.ts b/server/src/commands/fun/YoMomma.ts new file mode 100644 index 0000000..f156e8d --- /dev/null +++ b/server/src/commands/fun/YoMomma.ts @@ -0,0 +1,29 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Axios from 'axios'; + +export default class YoMommaFun extends Command { + public constructor() { + super('yomomma', { + aliases: ['yomomma', 'yo-momma'], + category: 'fun', + description: { + content: 'Grabs a "Yo Momma" joke.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise<Message> { + const fact = await Axios.get('https://api.yomomma.info/').catch(err => { + console.error(err); + return msg.reply('Woops, there was an error with the (https://api.yomomma.info/) API.'); + }); + //@ts-ignore + return msg.reply(fact.data.joke); + } +}
\ No newline at end of file |