diff options
| author | 8cy <[email protected]> | 2020-04-29 04:36:14 -0700 |
|---|---|---|
| committer | 8cy <[email protected]> | 2020-04-29 04:36:14 -0700 |
| commit | 68d32ab1fa9c79e848038ca1c451e7d8f368531b (patch) | |
| tree | 6142669ecc054e8a94bad4723dc6fb5c83f8cee1 /src | |
| parent | The Return, v8.2.0 (diff) | |
| download | dep-core-68d32ab1fa9c79e848038ca1c451e7d8f368531b.tar.xz dep-core-68d32ab1fa9c79e848038ca1c451e7d8f368531b.zip | |
Cerasus, v9.0.0
basically just add an insane amount of things
- all new animal commands
- waifu cmds
- change/ move clientid, invite, uwufy, support, howify, say, pfp
- add ip, security key, vote, datefacts, githubzen, fmk, fml, offsptring, facts, rate, opinion, onion, quantum coin, rolldie, romannumerals, russianrullete, smashorpass, spoiler, sub
- minecraft cmds
- SERVER check cmds
- lewd cmds
- roleplay commands
- fun commands and games
- utils
Diffstat (limited to 'src')
98 files changed, 3535 insertions, 37 deletions
@@ -29,7 +29,11 @@ client.registry ['crypto', 'Crypto Command Group'], ['zerotwo', 'Zero Two Command Group'], ['bot', 'Bot COmmand Group'], - ['user', 'User Command Group'] + ['user', 'User Command Group'], + ['utility', 'Utility Command Group'], + ['minecraft', 'Minecraft Command Group'], + ['animals', 'Animal Command Group'], + ['roleplay', 'Roleplay Command Group'] ]) .registerDefaultGroups() .registerDefaultCommands({ diff --git a/src/commands/animals/bunny.ts b/src/commands/animals/bunny.ts new file mode 100644 index 0000000..fb3b2b8 --- /dev/null +++ b/src/commands/animals/bunny.ts @@ -0,0 +1,38 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; +import axios from 'axios'; + +module.exports = class BunnyAnimals extends Command { + constructor(client) { + super(client, { + name: 'bunny', + aliases: [ + 'randombunny', + 'random-bunny' + ], + group: 'animals', + memberName: 'bunny', + description: 'Gives you a random bunny.', + examples: ['uwu!bunny'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage) { + try { + let emb = new MessageEmbed() + .setAuthor('bunnies.io') + .setColor(0xFFCC4D) + .setImage(await (await axios.get('https://api.bunnies.io/v2/loop/random/?media=gif,png')).data.media.gif) + msg.say(emb) + } catch (err) { + console.log(err) + msg.reply('Woops, there was an error with the (https://api.bunnies.io) API. ' + emoji.random()) + } + } +};
\ No newline at end of file diff --git a/src/commands/animals/cat.ts b/src/commands/animals/cat.ts new file mode 100644 index 0000000..2530830 --- /dev/null +++ b/src/commands/animals/cat.ts @@ -0,0 +1,38 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; +import axios from 'axios'; + +module.exports = class CatAnimals extends Command { + constructor(client) { + super(client, { + name: 'cat', + aliases: [ + 'randomcat', + 'random-cat' + ], + group: 'animals', + memberName: 'cat', + description: 'Gives you a random cat.', + examples: ['uwu!cat'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage) { + try { + let emb = new MessageEmbed() + .setAuthor('random.cat', 'https://i.imgur.com/Ik0Gf0r.png', 'https://random.cat') + .setColor(0xFFCC4D) + .setImage(await (await axios.get('https://aws.random.cat/meow')).data.file) + msg.say(emb) + } catch (err) { + console.log(err) + msg.reply('Woops, there was an error with the (http://random.cat) API. ' + emoji.random()) + } + } +};
\ No newline at end of file diff --git a/src/commands/fun/cow.ts b/src/commands/animals/cow.ts index e8fa60b..80eedf0 100644 --- a/src/commands/fun/cow.ts +++ b/src/commands/animals/cow.ts @@ -1,12 +1,12 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import cows from 'cows'; -module.exports = class CowFun extends Command { +module.exports = class CowAnimals extends Command { constructor(client) { super(client, { name: 'cow', aliases: ['cows'], - group: 'fun', + group: 'animals', memberName: 'cow', description: 'Gives you a random cow.', throttling: { diff --git a/src/commands/animals/dog.ts b/src/commands/animals/dog.ts new file mode 100644 index 0000000..118c951 --- /dev/null +++ b/src/commands/animals/dog.ts @@ -0,0 +1,38 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; +import axios from 'axios'; + +module.exports = class DogAnimals extends Command { + constructor(client) { + super(client, { + name: 'dog', + aliases: [ + 'randomdog', + 'random-dog' + ], + group: 'animals', + memberName: 'dog', + description: 'Gives you a random dog.', + examples: ['uwu!dog'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage) { + try { + let emb = new MessageEmbed() + .setAuthor('dog.ceo', 'https://dog.ceo/img/favicon.png', 'https://dog.ceo/dog-api/') + .setColor(0xFFCC4D) + .setImage(await (await axios.get('https://dog.ceo/api/breeds/image/random')).data.message) + msg.say(emb) + } catch (err) { + console.log(err) + msg.reply('Woops, there was an error with the (http://dog.ceo/dog-api) API. ' + emoji.random()) + } + } +};
\ No newline at end of file diff --git a/src/commands/animals/duck.ts b/src/commands/animals/duck.ts new file mode 100644 index 0000000..dbc4f94 --- /dev/null +++ b/src/commands/animals/duck.ts @@ -0,0 +1,38 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; +import axios from 'axios'; + +module.exports = class DuckAnimals extends Command { + constructor(client) { + super(client, { + name: 'duck', + aliases: [ + 'randomduck', + 'random-duck' + ], + group: 'animals', + memberName: 'duck', + description: 'Gives you a random duck.', + examples: ['uwu!duck'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage) { + try { + let emb = new MessageEmbed() + .setAuthor('random-d.uk', 'https://random-d.uk/favicon.ico', 'https://random-d.uk') + .setColor(0xFFCC4D) + .setImage(await (await axios.get('https://random-d.uk/api/v1/random?type=gif')).data.url) + msg.say(emb) + } catch (err) { + console.log(err) + msg.reply('Woops, there was an error with the (https://random-d.uk) API. ' + emoji.random()) + } + } +};
\ No newline at end of file diff --git a/src/commands/animals/fox.ts b/src/commands/animals/fox.ts new file mode 100644 index 0000000..86cab3a --- /dev/null +++ b/src/commands/animals/fox.ts @@ -0,0 +1,38 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; +import axios from 'axios'; + +module.exports = class FoxAnimals extends Command { + constructor(client) { + super(client, { + name: 'fox', + aliases: [ + 'randomfox', + 'random-fox' + ], + group: 'animals', + memberName: 'fox', + description: 'Gives you a random fox.', + examples: ['uwu!fox'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage) { + try { + let emb = new MessageEmbed() + .setAuthor('randomfox.ca') + .setColor(0xFFCC4D) + .setImage(await (await axios.get('https://randomfox.ca/floof/')).data.image) + msg.say(emb) + } catch (err) { + console.log(err) + msg.reply('Woops, there was an error with the (https://randomfox.ca/) API. ' + emoji.random()) + } + } +};
\ No newline at end of file diff --git a/src/commands/animals/owl.ts b/src/commands/animals/owl.ts new file mode 100644 index 0000000..9f219ac --- /dev/null +++ b/src/commands/animals/owl.ts @@ -0,0 +1,38 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; +import axios from 'axios'; + +module.exports = class OwlAnimals extends Command { + constructor(client) { + super(client, { + name: 'owl', + aliases: [ + 'randomowl', + 'random-owl' + ], + group: 'animals', + memberName: 'owl', + description: 'Gives you a random owl.', + examples: ['uwu!owl'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + async run(msg: CommandoMessage) { + try { + let emb = new MessageEmbed() + .setAuthor('pics.floofybot.moe/owl', 'http://pics.floofybot.moe/assets/favicon.svg', 'http://pics.floofybot.moe/') + .setColor(0xFFCC4D) + .setImage(await (await axios.get('http://pics.floofybot.moe/owl')).data.image) + msg.say(emb) + } catch (err) { + console.log(err) + msg.reply('Woops, there was an error with the (http://pics.floofybot.moe/) API. ' + emoji.random()) + } + } +};
\ No newline at end of file diff --git a/src/commands/anime/uwufy.ts b/src/commands/anime/uwufy.ts index e3f5f8a..45bb3d1 100644 --- a/src/commands/anime/uwufy.ts +++ b/src/commands/anime/uwufy.ts @@ -2,12 +2,12 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import emoji from 'emoji-random'; import uwufy from 'uwufy' -module.exports = class UwufyFun extends Command { +module.exports = class UwufyAnime extends Command { constructor(client) { super(client, { name: 'uwufy', aliases: ['uwu', 'owofy', 'owo'], - group: 'fun', + group: 'anime', memberName: 'uwufy', description: 'Uwufys anything you send.', args: [ diff --git a/src/commands/anime/waifu.ts b/src/commands/anime/waifu.ts new file mode 100644 index 0000000..80363e3 --- /dev/null +++ b/src/commands/anime/waifu.ts @@ -0,0 +1,34 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import request from 'node-superfetch'; +import { MessageEmbed } from 'discord.js'; +import { shorten } from '../../utils/Util.js' + +module.exports = class WaifuAnime extends Command { + constructor(client) { + super(client, { + name: 'waifu', + aliases: ['thiswaifudoesnotexist', 'this-waifu-does-not-exist'], + group: 'anime', + memberName: 'waifu', + description: 'Replies with a randomly generated waifu and a backstory. WARNING: don\'t get too attatched.', + examples: [ + + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + }); + } + async run(msg: CommandoMessage) { + const num = Math.floor(Math.random() * 100000) + const { text } = await request.get(`https://www.thiswaifudoesnotexist.net/snippet-${num}.txt`) + let emb = new MessageEmbed() + .setDescription(shorten(text, 1000)) + .setColor(0xFFCC4D) + .setThumbnail(`https://www.thiswaifudoesnotexist.net/example-${num}.jpg`) + msg.reply(emb) + } +};
\ No newline at end of file diff --git a/src/commands/bot/clientid.ts b/src/commands/bot/clientid.ts index 65040bf..9e7565c 100644 --- a/src/commands/bot/clientid.ts +++ b/src/commands/bot/clientid.ts @@ -9,7 +9,7 @@ module.exports = class ClientIDBot extends Command { aliases: ['cid'], group: 'bot', memberName: 'clientid', - description: 'Tells you the bot\'s client ID version.', + description: 'Tells you the bot\'s client ID.', examples: ['uwu!clientid', 'uwu!cid'], userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], @@ -20,14 +20,6 @@ module.exports = class ClientIDBot extends Command { }); } run(msg: CommandoMessage) { - msg.say('Please wait...').then(m => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription('uwufier\'s client ID is **699473263998271489**. ' + emoji.random()) - .setColor(0xFFCC4D) - - msg.say(emb); - }); + msg.reply(`**uwufier\'s** client ID is **699473263998271489**. ${emoji.random()}`) } };
\ No newline at end of file diff --git a/src/commands/bot/generatecommands.ts b/src/commands/bot/generatecommands.ts new file mode 100644 index 0000000..11010c0 --- /dev/null +++ b/src/commands/bot/generatecommands.ts @@ -0,0 +1,45 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; +import request from 'node-superfetch' + +module.exports = class GenerateCommandsBot extends Command { + constructor(client) { + super(client, { + name: 'generatecommands', + aliases: [ + 'generate-commands', + 'generatecmds', + 'generate-cmds', + 'gencommands', + 'gen-commands', + 'gencmds', + 'gen-cmds' + ], + group: 'bot', + memberName: 'generatecommands', + description: 'Generates a .txt file with all of the available commands.', + examples: ['uwu!gencmds'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + ownerOnly: true, + guarded: true + }); + } + async run(msg: CommandoMessage) { + const list = this.client.registry.groups + .map(g => { + const commands = g.commands.filter(c => !c.hidden) + return `\n### ${g.name}\n\n${commands.map(c => { + const extra = `${c.ownerOnly ? ' (Owner-Only)' : ''}${c.nsfw ? ' (NSFW)' : ''}` + return `* ** ${c.name}:** ${c.description}${extra}` + }).join('\n')}` + }) + const text = `Total: ${this.client.registry.commands.size}\n${list.join('\n')}` + return msg.reply({ files: [{ attachment: Buffer.from(text), name: 'commands.txt' }] }) + } +};
\ No newline at end of file diff --git a/src/commands/bot/guildbackdoor.ts b/src/commands/bot/guildbackdoor.ts new file mode 100644 index 0000000..1282cdd --- /dev/null +++ b/src/commands/bot/guildbackdoor.ts @@ -0,0 +1,54 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' + +module.exports = class GuildBackdoorBot extends Command { + constructor(client) { + super(client, { + name: 'guildbackdoor', + aliases: [ + 'guild-backdoor', + 'serverbackdoor', + 'server-backdoor' + ], + group: 'fun', + memberName: 'guildbackdoor', + description: 'Checks who the oldest member on the server is.', + examples: ['uwu!guildbackdoor 1234567890'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + hidden: true, + args: [ + { + key: 'gGuild', + prompt: 'What server would you like to join?', + type: 'string' + } + ], + ownerOnly: true + }); + } + async run(msg: CommandoMessage, { gGuild }) { + if (this.client.guilds.cache.has(gGuild)) msg.reply(`Either that is not a valid guild ID or ${this.client.user} is not a member of that guild.`) + + gGuild = this.client.guilds.cache.get(gGuild) + + const invites = await gGuild.fetchInvites() + console.debug('This guild\'s invites:', invites) + if (invites.size > 0) { + msg.author.send(invites.first().url) + } + + // TODO: fix this one day, no idea how to. error: cant find permissionsfor on the channel thing + // for (const channel of gGuild.channels.cache.values()) { + // if (channel.permissionsFor(gGuild.me).has('CREATE_INSTANT_INVITE')) { + // msg.reply(await channel.createInvite({ maxAge: 0 }).url) + // } + // } + + //msg.reply('No existing invites or channels to invite you to. ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/bot/invite.ts b/src/commands/bot/invite.ts index 0b72063..479e1a8 100644 --- a/src/commands/bot/invite.ts +++ b/src/commands/bot/invite.ts @@ -1,5 +1,6 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; module.exports = class InviteBot extends Command { constructor(client) { @@ -19,6 +20,8 @@ module.exports = class InviteBot extends Command { }); } run(msg: CommandoMessage) { - msg.reply('https://crack.cf/uwu ' + emoji.random()) + let emb = new MessageEmbed() + .setDescription('To invite the bot, please use [this link](https://crack.cf/uwu). ' + emoji.random()) + msg.say(emb) } };
\ No newline at end of file diff --git a/src/commands/bot/ip.ts b/src/commands/bot/ip.ts new file mode 100644 index 0000000..c9c8ec0 --- /dev/null +++ b/src/commands/bot/ip.ts @@ -0,0 +1,38 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; +import request from 'node-superfetch' + +module.exports = class IPBot extends Command { + constructor(client) { + super(client, { + name: 'ip', + group: 'bot', + memberName: 'ip', + description: 'Gives you the bot\'s ip.', + examples: ['uwu!ip'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + ownerOnly: true + }); + } + async run(msg: CommandoMessage) { + let { body } = await request + .get('https://api.ipify.org') + .query({ format: 'json' }) + + msg.say('Please wait...').then(m => { + m.edit(`** **`); + + let emb = new MessageEmbed() + .setDescription(`uwufier\'s current IP address is **${body.ip}**. ` + emoji.random()) + .setColor(0xFFCC4D) + + msg.say(emb); + }); + } +};
\ No newline at end of file diff --git a/src/commands/bot/support.ts b/src/commands/bot/support.ts index c022de7..f6818ef 100644 --- a/src/commands/bot/support.ts +++ b/src/commands/bot/support.ts @@ -1,5 +1,6 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; module.exports = class SupportBot extends Command { constructor(client) { @@ -18,6 +19,8 @@ module.exports = class SupportBot extends Command { }); } run(msg: CommandoMessage) { - msg.reply('For support, please join; https://crack.cf/uwufier-support. ' + emoji.random()) + let emb = new MessageEmbed() + .setDescription('For support, please join [this server](https://crack.cf/uwufier-support). ' + emoji.random()) + msg.say(emb) } };
\ No newline at end of file diff --git a/src/commands/bot/vote.ts b/src/commands/bot/vote.ts new file mode 100644 index 0000000..8f64686 --- /dev/null +++ b/src/commands/bot/vote.ts @@ -0,0 +1,25 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class VoteBot extends Command { + constructor(client) { + super(client, { + name: 'vote', + group: 'bot', + memberName: 'vote', + description: 'Gives you the bot\'s top.gg vote link.', + examples: ['uwu!vote'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + }); + } + run(msg: CommandoMessage) { + let emb = new MessageEmbed() + .setDescription('To vote, please use [this link](https://discordbots.org/bot/699473263998271489/vote). 🗳') + msg.say(emb) + } +};
\ No newline at end of file diff --git a/src/commands/crypto/securitykey.ts b/src/commands/crypto/securitykey.ts new file mode 100644 index 0000000..649320a --- /dev/null +++ b/src/commands/crypto/securitykey.ts @@ -0,0 +1,26 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import crypto from 'crypto' + +module.exports = class RateCrypto extends Command { + constructor(client) { + super(client, { + name: 'securitykey', + aliases: ['security-key'], + group: 'crypto', + memberName: 'securitykey', + description: 'Generates a security key.', + examples: ['uwu!securitykey'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + msg.reply(`Check your DMs! ${emoji.random()}`) + msg.author.send(crypto.randomBytes(15).toString('hex') + ' ' + emoji.random()) + } +};
\ No newline at end of file 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/offspring.ts b/src/commands/fun/offspring.ts new file mode 100644 index 0000000..7152a1c --- /dev/null +++ b/src/commands/fun/offspring.ts @@ -0,0 +1,24 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +const genders = ['boy', 'girl'] + +module.exports = class OffspringFun extends Command { + constructor(client) { + super(client, { + name: 'offspring', + group: 'fun', + memberName: 'offspring', + description: 'Determines your child\'s gender.', + examples: ['uwu!offspring'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + }); + } + run(msg: CommandoMessage) { + 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 diff --git a/src/commands/minecraft/getbody.ts b/src/commands/minecraft/getbody.ts new file mode 100644 index 0000000..3fb6eec --- /dev/null +++ b/src/commands/minecraft/getbody.ts @@ -0,0 +1,45 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class GetBodyMinecraft extends Command { + constructor(client) { + super(client, { + name: 'getbody', + aliases: [ + 'get-body', + 'getmcbody', + 'get-mc-body', + 'gmcb' + ], + group: 'minecraft', + memberName: 'getbody', + description: 'Grabs a specified player\'s body from Minecraft.', + examples: [ + 'uwu!getbody notch', + 'uwu!gmcb sin' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUsername', + prompt: 'What is the account name of the user?', + type: 'string' + } + ] + }); + } + async run(msg: CommandoMessage, { uUsername }) { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setAuthor(uUsername, `https://minotar.net/body/${encodeURIComponent(uUsername)}`) + .setImage(`https://minotar.net/body/${encodeURIComponent(uUsername)}`) + + //console.debug(`URL for ${uUsername}:`, emb.image?.url) + msg.reply(emb) + } +};
\ No newline at end of file diff --git a/src/commands/minecraft/getface.ts b/src/commands/minecraft/getface.ts new file mode 100644 index 0000000..b53e6fb --- /dev/null +++ b/src/commands/minecraft/getface.ts @@ -0,0 +1,43 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class GetFaceMinecraft extends Command { + constructor(client) { + super(client, { + name: 'getface', + aliases: [ + 'get-face', + 'getmcface', + 'get-mc-face', + 'gmcf' + ], + group: 'minecraft', + memberName: 'getface', + description: 'Grabs a specified player\'s face from Minecraft.', + examples: [ + 'uwu!getface notch', + 'uwu!gmcf sin' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUsername', + prompt: 'What is the account name of the user?', + type: 'string' + } + ] + }); + } + async run(msg: CommandoMessage, { uUsername }) { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) + .setImage(`https://minotar.net/helm/${encodeURIComponent(uUsername)}`) + msg.reply(emb) + } +};
\ No newline at end of file diff --git a/src/commands/minecraft/gethead.ts b/src/commands/minecraft/gethead.ts new file mode 100644 index 0000000..665d01e --- /dev/null +++ b/src/commands/minecraft/gethead.ts @@ -0,0 +1,43 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class GetHeadMinecraft extends Command { + constructor(client) { + super(client, { + name: 'gethead', + aliases: [ + 'get-head', + 'getmchead', + 'get-mc-head', + 'gmch' + ], + group: 'minecraft', + memberName: 'gethead', + description: 'Grabs a specified player\'s head from Minecraft.', + examples: [ + 'uwu!gethead notch', + 'uwu!gmch sin' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUsername', + prompt: 'What is the account name of the user?', + type: 'string' + } + ] + }); + } + async run(msg: CommandoMessage, { uUsername }) { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) + .setImage(`https://minotar.net/cube/${encodeURIComponent(uUsername)}/100.png`) + msg.reply(emb) + } +};
\ No newline at end of file diff --git a/src/commands/minecraft/getminime.ts b/src/commands/minecraft/getminime.ts new file mode 100644 index 0000000..c948d38 --- /dev/null +++ b/src/commands/minecraft/getminime.ts @@ -0,0 +1,59 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class GetMiniMeMinecraft extends Command { + constructor(client) { + super(client, { + name: 'getminime', + aliases: [ + 'get-mini-me', + 'getmcminime', + 'get-mc-mini-me', + 'gmcmm' + ], + group: 'minecraft', + memberName: 'getminime', + description: 'Grabs a specified player\'s skin from Minecraft.', + examples: [ + 'uwu!getminime notch', + 'uwu!gmcmm sin false' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUsername', + prompt: 'What is the account name of the user?', + type: 'string' + }, + { + key: 'uTrans', + prompt: 'Would you like the background to be transparant? (yes or no)', + type: 'string', + default: true + } + ] + }); + } + async run(msg: CommandoMessage, { uUsername, uTrans }) { + //console.debug('Transparency value:', uTrans) + + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setAuthor(uUsername, `http://minecraftskinavatar.com/customize?id=${encodeURIComponent(uUsername)}&source=minecraft`, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) + .setFooter('[Provided by minecraftskinavatar.com](Provided by minecraftskinavatar.com)') + + if (uTrans) { + emb.setImage(`http://avatar.yourminecraftservers.com/avatar/trnsp/steve/tall/128/${encodeURIComponent(uUsername)}.png`) + } else { + emb.setImage(`http://avatar.yourminecraftservers.com/avatar/rad/steve/tall/128/${encodeURIComponent(username)}.png`) + } + + //console.debug(`Image URL for ${uUsername}: ${emb.image?.url}`) + msg.reply(emb) + } +};
\ No newline at end of file diff --git a/src/commands/minecraft/getskin.ts b/src/commands/minecraft/getskin.ts new file mode 100644 index 0000000..ff2deb2 --- /dev/null +++ b/src/commands/minecraft/getskin.ts @@ -0,0 +1,43 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class GetSkinMinecraft extends Command { + constructor(client) { + super(client, { + name: 'getskin', + aliases: [ + 'get-skin', + 'getmcskin', + 'get-mc-skin', + 'gmcs' + ], + group: 'minecraft', + memberName: 'getskin', + description: 'Grabs a specified player\'s skin from Minecraft.', + examples: [ + 'uwu!getskin notch', + 'uwu!gmcs sin' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUsername', + prompt: 'What is the account name of the user?', + type: 'string' + } + ] + }); + } + async run(msg: CommandoMessage, { uUsername }) { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setAuthor(uUsername, `https://minotar.net/helm/${encodeURIComponent(uUsername)}`) + .setImage(`https://minotar.net/skin/${encodeURIComponent(uUsername)}`) + msg.reply(emb) + } +};
\ No newline at end of file diff --git a/src/commands/minecraft/minecraftserverstatus.ts b/src/commands/minecraft/minecraftserverstatus.ts new file mode 100644 index 0000000..156a04f --- /dev/null +++ b/src/commands/minecraft/minecraftserverstatus.ts @@ -0,0 +1,74 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +import axios from 'axios' +import emoji from 'emoji-random' + +module.exports = class MinecraftServerMinecraft extends Command { + constructor(client) { + super(client, { + name: 'minecraftserverstatus', + aliases: [ + 'mcserverstatus', + 'minecraft-server-status', + 'mcss' + ], + group: 'utility', + memberName: 'minecraftserverstatus', + description: 'Grabs you the server status of a Minecraft server.', + examples: [ + 'uwu!minecraftserverstatus', + 'uwu!mcss' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'ip', + prompt: 'What is the IP of the server?', + type: 'string' + }, + { + key: 'port', + prompt: 'What is the port of the server?', + type: 'integer', + default: '25565', + max: 65535, + min: 1 + } + ] + }); + } + async run(msg: CommandoMessage, { ip, port }) { + const res = ( + await axios(`https://mcapi.us/server/status?ip=${ip}&port=${port}`).catch(err => { + console.error(err) + return msg.reply('Woops, an error has occured. ' + emoji.random()) + }) + ).data + + if (res.status !== 'success') { + return msg.reply('Woops, there was an error with your request. ' + emoji.random()) + } + + let emb = new MessageEmbed() + .setTitle(ip) + .setTimestamp(res.last_updated) + .setColor(0xFFCC4D) + + if (res.online) { + emb.addField('Server Status', 'Currentaly online.', true) + emb.addField('Version', res.server.name, true) + emb.addField('Members', `${res.players.now}/${res.players.max}`, true) + emb.addField('MOTD', `\`\`\`${res.motd}\`\`\``, true) + } else if (res.last_online) { + emb.addField('Server Status', `Offline. Last seen ${new Date(res.last_online)}`, true) + } else { + emb.addField('Server Status', 'Offline. Never seen online before.', true) + } + return msg.reply(emb) + } +};
\ No newline at end of file diff --git a/src/commands/nsfw/danbooru.ts b/src/commands/nsfw/danbooru.ts index 87df99e..68bcc17 100644 --- a/src/commands/nsfw/danbooru.ts +++ b/src/commands/nsfw/danbooru.ts @@ -2,7 +2,7 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; import axios from 'axios' -export default class DanbooruBot extends Command { +export default class DanbooruNSFW extends Command { constructor(client) { super(client, { name: 'danbooru', @@ -34,15 +34,15 @@ export default class DanbooruBot extends Command { let blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat']; if (tags !== 0) { - if (blacklist.includes(tags)) { - msg.reply('Blacklisted word was used! ⛔') + if (blacklist.includes(tags.toLowerCase())) { + return msg.reply('Blacklisted word was used! ⛔') } } let res = await axios.get(`https://danbooru.donmai.us/posts.json?limit=200&tags=${tags}+-rating:safe`) - if (blacklist.includes(res.data[randomInt].tags)) { - msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') + if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { + return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') } let getRating = (rating) => { diff --git a/src/commands/nsfw/gelbooru.ts b/src/commands/nsfw/gelbooru.ts index 2f6fdeb..6a21c10 100644 --- a/src/commands/nsfw/gelbooru.ts +++ b/src/commands/nsfw/gelbooru.ts @@ -2,7 +2,7 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; import axios from 'axios' -export default class GelbooruBot extends Command { +export default class GelbooruNSFW extends Command { constructor(client) { super(client, { name: 'gelbooru', @@ -34,15 +34,15 @@ export default class GelbooruBot extends Command { let blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat']; if (tags !== 0) { - if (blacklist.includes(tags)) { - msg.reply('Blacklisted word was used! ⛔') + if (blacklist.includes(tags.toLowerCase())) { + return msg.reply('Blacklisted word was used! ⛔') } } let res = await axios.get(`https://gelbooru.com/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`) - if (blacklist.includes(res.data[randomInt].tags)) { - msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') + if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { + return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') } let getRating = (rating) => { diff --git a/src/commands/nsfw/rule34.ts b/src/commands/nsfw/rule34.ts index eb6fa10..669fcad 100644 --- a/src/commands/nsfw/rule34.ts +++ b/src/commands/nsfw/rule34.ts @@ -2,7 +2,7 @@ import { Command, CommandoMessage } from 'discord.js-commando'; import { MessageEmbed } from 'discord.js'; import axios from 'axios' -export default class Rule34Bot extends Command { +export default class Rule34NSFW extends Command { constructor(client) { super(client, { name: 'rule34', @@ -24,7 +24,8 @@ export default class Rule34Bot extends Command { { key: 'tags', prompt: 'What tag(s) would you like?', - type: 'string' + type: 'string', + default: '', } ], nsfw: true @@ -32,18 +33,18 @@ export default class Rule34Bot extends Command { } async run(msg: CommandoMessage, { tags }) { let randomInt = Math.floor(Math.random() * 100) - let blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat']; + let blacklist = ['loli', 'shota', 'cub', 'young', 'child', 'baby', 'guro', 'gore', 'vore', 'scat', 'poop']; if (tags !== 0) { - if (blacklist.includes(tags)) { - msg.reply('Blacklisted word was used! ⛔') + if (blacklist.includes(tags.toLowerCase())) { + return msg.reply('Blacklisted word was used! ⛔') } } let res = await axios.get(`http://rule34.xxx/index.php?page=dapi&s=post&q=index&limit=100&tags=${tags}+-rating:safe&json=1`) - if (blacklist.includes(res.data[randomInt].tags)) { - msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') + if (blacklist.includes(res.data[randomInt].tags.toLowerCase())) { + return msg.reply('Sorry! This image had a tag that was blacklisted! ⛔') } let emb = new MessageEmbed() diff --git a/src/commands/roleplay/blush.ts b/src/commands/roleplay/blush.ts new file mode 100644 index 0000000..bbf0107 --- /dev/null +++ b/src/commands/roleplay/blush.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class BlushRoleplay extends Command { + constructor(client) { + super(client, { + name: 'blush', + group: 'roleplay', + memberName: 'blush', + description: 'Blush at a specified user.', + examples: ['uwu!blush @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to blush at?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** blushes at **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/celebrate.ts b/src/commands/roleplay/celebrate.ts new file mode 100644 index 0000000..6924b39 --- /dev/null +++ b/src/commands/roleplay/celebrate.ts @@ -0,0 +1,23 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class CelebrateRoleplay extends Command { + constructor(client) { + super(client, { + name: 'celebrate', + group: 'roleplay', + memberName: 'celebrate', + description: 'Celebrate.', + examples: ['uwu!celebrate'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + } + }); + } + run(msg: CommandoMessage) { + msg.say(`_**${msg.author.username}** celebrates._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/eat.ts b/src/commands/roleplay/eat.ts new file mode 100644 index 0000000..ba2c364 --- /dev/null +++ b/src/commands/roleplay/eat.ts @@ -0,0 +1,23 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class EatRoleplay extends Command { + constructor(client) { + super(client, { + name: 'eat', + group: 'roleplay', + memberName: 'eat', + description: 'Eat.', + examples: ['uwu!eat'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + } + }); + } + run(msg: CommandoMessage) { + msg.say(`_**${msg.author.username}** eats._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/fistbump.ts b/src/commands/roleplay/fistbump.ts new file mode 100644 index 0000000..1a2f6db --- /dev/null +++ b/src/commands/roleplay/fistbump.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class FistBumpRoleplay extends Command { + constructor(client) { + super(client, { + name: 'fistbump', + aliases: ['fist-bump'], + group: 'roleplay', + memberName: 'fistbump', + description: 'Fist-bump with a specified user.', + examples: ['uwu!fistbump @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to fist-bump?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** fist-bumps **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/highfive.ts b/src/commands/roleplay/highfive.ts new file mode 100644 index 0000000..bb9435d --- /dev/null +++ b/src/commands/roleplay/highfive.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class HighFiveRoleplay extends Command { + constructor(client) { + super(client, { + name: 'highfive', + aliases: ['high-five'], + group: 'roleplay', + memberName: 'highfive', + description: 'High-fave with a specified user.', + examples: ['uwu!highfive @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to high-five?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** high-fives **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/holdhands.ts b/src/commands/roleplay/holdhands.ts new file mode 100644 index 0000000..acfa78e --- /dev/null +++ b/src/commands/roleplay/holdhands.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class HoldHandsRoleplay extends Command { + constructor(client) { + super(client, { + name: 'holdhands', + aliases: ['hold-hands', 'holdhand', 'hold-hand'], + group: 'roleplay', + memberName: 'holdhands', + description: 'Hold hands with a specified user.', + examples: ['uwu!holdhands @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to hold hands with?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** holds **${uUser.username}** hand._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/hug.ts b/src/commands/roleplay/hug.ts new file mode 100644 index 0000000..06e267b --- /dev/null +++ b/src/commands/roleplay/hug.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class HugRoleplay extends Command { + constructor(client) { + super(client, { + name: 'hug', + group: 'roleplay', + memberName: 'hug', + description: 'Hug hands with a specified user.', + examples: ['uwu!hug @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to hug?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** hugs **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/inhale.ts b/src/commands/roleplay/inhale.ts new file mode 100644 index 0000000..4765a86 --- /dev/null +++ b/src/commands/roleplay/inhale.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class InhaleRoleplay extends Command { + constructor(client) { + super(client, { + name: 'inhale', + group: 'roleplay', + memberName: 'inhale', + description: 'Inhale a specified user.', + examples: ['uwu!inhale @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to inhale?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** inhales **${uUser.username}** but gained no abilities._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/kill.ts b/src/commands/roleplay/kill.ts new file mode 100644 index 0000000..5756ad0 --- /dev/null +++ b/src/commands/roleplay/kill.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class KillRoleplay extends Command { + constructor(client) { + super(client, { + name: 'kill', + group: 'roleplay', + memberName: 'kill', + description: 'Kill a specified user.', + examples: ['uwu!kill @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to kill?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** kills **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/kiss.ts b/src/commands/roleplay/kiss.ts new file mode 100644 index 0000000..7b455c7 --- /dev/null +++ b/src/commands/roleplay/kiss.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class KissRoleplay extends Command { + constructor(client) { + super(client, { + name: 'kiss', + group: 'roleplay', + memberName: 'kiss', + description: 'Kiss a specified user.', + examples: ['uwu!kiss @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to kiss?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** kisses **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/pat.ts b/src/commands/roleplay/pat.ts new file mode 100644 index 0000000..70649a4 --- /dev/null +++ b/src/commands/roleplay/pat.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class PatRoleplay extends Command { + constructor(client) { + super(client, { + name: 'pat', + group: 'roleplay', + memberName: 'pat', + description: 'Pat a specified user.', + examples: ['uwu!pat @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to pat?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** pat **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/poke.ts b/src/commands/roleplay/poke.ts new file mode 100644 index 0000000..6d8525d --- /dev/null +++ b/src/commands/roleplay/poke.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class PokeRoleplay extends Command { + constructor(client) { + super(client, { + name: 'poke', + group: 'roleplay', + memberName: 'poke', + description: 'Poke a specified user.', + examples: ['uwu!poke @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to poke?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** pokes **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/punch.ts b/src/commands/roleplay/punch.ts new file mode 100644 index 0000000..980bcff --- /dev/null +++ b/src/commands/roleplay/punch.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class PunchRoleplay extends Command { + constructor(client) { + super(client, { + name: 'punch', + group: 'roleplay', + memberName: 'punch', + description: 'Punch a specified user.', + examples: ['uwu!punch @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to punch?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** punches **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/slap.ts b/src/commands/roleplay/slap.ts new file mode 100644 index 0000000..f007cb7 --- /dev/null +++ b/src/commands/roleplay/slap.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class SlapRoleplay extends Command { + constructor(client) { + super(client, { + name: 'slap', + group: 'roleplay', + memberName: 'slap', + description: 'Slap a specified user.', + examples: ['uwu!slap @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to slap?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** slaps **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/sleep.ts b/src/commands/roleplay/sleep.ts new file mode 100644 index 0000000..0d8beb2 --- /dev/null +++ b/src/commands/roleplay/sleep.ts @@ -0,0 +1,23 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class SleepRoleplay extends Command { + constructor(client) { + super(client, { + name: 'sleep', + group: 'roleplay', + memberName: 'sleep', + description: 'Sleep.', + examples: ['uwu!sleep'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + } + }); + } + run(msg: CommandoMessage) { + msg.say(`_**${msg.author.username}** falls asleep._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/wakeup.ts b/src/commands/roleplay/wakeup.ts new file mode 100644 index 0000000..d8418a7 --- /dev/null +++ b/src/commands/roleplay/wakeup.ts @@ -0,0 +1,24 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class WakeUpRoleplay extends Command { + constructor(client) { + super(client, { + name: 'wakeup', + aliases: ['wake-up'], + group: 'roleplay', + memberName: 'wakeup', + description: 'Wake up.', + examples: ['uwu!wakeup'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + } + }); + } + run(msg: CommandoMessage) { + msg.say(`_**${msg.author.username}** wakes up._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/wave.ts b/src/commands/roleplay/wave.ts new file mode 100644 index 0000000..32b9f6e --- /dev/null +++ b/src/commands/roleplay/wave.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class WaveRoleplay extends Command { + constructor(client) { + super(client, { + name: 'wave', + group: 'roleplay', + memberName: 'wave', + description: 'Wave a specified user.', + examples: ['uwu!wave @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to wave at?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** waves at **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/roleplay/wink.ts b/src/commands/roleplay/wink.ts new file mode 100644 index 0000000..a3360ee --- /dev/null +++ b/src/commands/roleplay/wink.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; + +module.exports = class WinkRoleplay extends Command { + constructor(client) { + super(client, { + name: 'wink', + group: 'roleplay', + memberName: 'wink', + description: 'Wink a specified user.', + examples: ['uwu!wink @sin#1337'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to wink at?', + type: 'user' + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.say(`_**${msg.author.username}** winks at **${uUser.username}**._` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/server/oldestmember.ts b/src/commands/server/oldestmember.ts new file mode 100644 index 0000000..c14e694 --- /dev/null +++ b/src/commands/server/oldestmember.ts @@ -0,0 +1,50 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { formatDistance, formatRelative } from 'date-fns' +import { stripIndents } from 'common-tags' + +module.exports = class OldestMemberServer extends Command { + constructor(client) { + super(client, { + name: 'oldestmember', + aliases: [ + 'oldest-member', + 'oldestuser', + 'oldest-user', + 'oldest' + ], + group: 'fun', + memberName: 'oldestmember', + description: 'Checks who the oldest member on the server is.', + examples: ['uwu!oldestmember'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + guildOnly: true + }); + } + run(msg: CommandoMessage) { + const oldest = msg.guild.members + .cache.sort((member1, member2) => { + const timestamp1 = member1.user.createdTimestamp + const timestamp2 = member2.user.createdTimestamp + + if (timestamp1 > timestamp2) { + return 1 + } else if (timestamp1 < timestamp2) { + return -1 + } + return 0 + }) + .first()?.user + + const { createdAt } = oldest + const age = formatDistance(createdAt, new Date()) + const date = formatRelative(createdAt, new Date()) + msg.reply(stripIndents`${oldest.tag} is the oldest member in this server. + Their account is **${age}** old (created **${date}**).` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/server/quotemessage.ts b/src/commands/server/quotemessage.ts new file mode 100644 index 0000000..7dc2965 --- /dev/null +++ b/src/commands/server/quotemessage.ts @@ -0,0 +1,88 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; +import tt from '../../utils/truncateText.js' +import path from 'path' + +module.exports = class QuoteMessageServer extends Command { + constructor(client) { + super(client, { + name: 'quotemessage', + aliases: [ + 'quote-message', + 'quotemsg', + 'quote-msg' + ], + group: 'fun', + memberName: 'quotemessage', + description: 'Quote a message from a text channel.', + examples: ['uwu!quotemessage 424936127154094080'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'mMsg', + prompt: 'What message would you like to quote?', + type: 'message', + label: 'message ID' + } + ] + }); + } + run(msg: CommandoMessage, { mMsg }) { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setTimestamp(mMsg.createdAt) + .setAuthor(mMsg.author.tag, mMsg.author.avatarUrl) // TODO: fix avatarurl not working + .addFields([ + { + name: 'Channel', + value: mMsg.channel.toString() + }, + { + name: 'Message', + value: `[Jump to](https://discordapp.com/channels/${mMsg.guild.id}/${mMsg.channel.id}/${mMsg.id})` + } + ]) + + // check if msg had content + console.debug('Does the message have content:', Boolean(mMsg.content)) + if (mMsg.content) emb.setDescription(tt(mMsg.content)) + + // get img from msg + let messageImage + // valid img file extensions + const extensions = ['.png', '.jpg', '.jpeg', '.gif', '.webp'] + // regex for url to img + const linkRegex = /https?:\/\/(?:\w+\.)?[\w-]+\.[\w]{2,3}(?:\/[\w-_.]+)+\.(?:png|jpg|jpeg|gif|webp)/; + + // embed (that may or may not exist) with an img in it + const imageEmbed = mMsg.embeds.find( + msgEmbed => msgEmbed.type === 'rich' && msgEmbed.image && extensions.includes(path.extname(msgEmbed.image.url)) + ) + if (imageEmbed) messageImage = imageEmbed.image.url + + // uploaded img + const attachment = mMsg.attachments.find(file => extensions.includes(path.extname(file.url))) + if (attachment) { + messageImage = attachment.url + } + + // if there wasnt an uploaded img check if there was a url to one + if (!messageImage) { + const linkMatch = mMsg.content.match(linkRegex) + if (linkMatch && extensions.includes(path.extname(linkMatch[0]))) { + [messageImage] = linkMatch + } + } + + // if there was an img, set embed image to it + if (messageImage) emb.setImage(messageImage) + + msg.say(emb) + } +};
\ No newline at end of file diff --git a/src/commands/server/randommember.ts b/src/commands/server/randommember.ts new file mode 100644 index 0000000..e818e61 --- /dev/null +++ b/src/commands/server/randommember.ts @@ -0,0 +1,34 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' + +module.exports = class RandomMemberServer extends Command { + constructor(client) { + super(client, { + name: 'randommember', + aliases: [ + 'random-member', + 'randomuser', + 'random-user', + 'someone', + '@someone', + ], + group: 'fun', + memberName: 'randommember', + description: 'Gets a random member from the server.', + examples: ['uwu!randommember'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'] + }); + } + run(msg: CommandoMessage) { + if (msg.channel.type === 'dm') { + const members = [this.client.user, msg.channel.recipient]; + return msg.reply(`I choose ${members[Math.floor(Math.random() * members.length)].username}! ${emoji.random()}`); + } + return msg.reply(`I choose ${msg.guild.members.cache.random().displayName}! ${emoji.random()}`); + } +};
\ No newline at end of file diff --git a/src/commands/server/roleinfo.ts b/src/commands/server/roleinfo.ts new file mode 100644 index 0000000..3fc3814 --- /dev/null +++ b/src/commands/server/roleinfo.ts @@ -0,0 +1,61 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; + +module.exports = class RoleInfoServer extends Command { + constructor(client) { + super(client, { + name: 'roleinfo', + aliases: [ + 'role-info' + ], + group: 'fun', + memberName: 'roleinfo', + description: 'Gets information on a specified role.', + examples: ['uwu!roleinfo @Role'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + guildOnly: true, + args: [ + { + key: 'rRole', + prompt: 'What role would you like to get information on?', + type: 'role' + } + ] + }); + } + run(msg: CommandoMessage, { rRole }) { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setTitle(`${rRole.name} (${rRole.id})`) + .setTimestamp(rRole.createdAt) + .addFields([ + { + name: '🔢 Position', + value: `${rRole.position + 1} (raw position: ${rRole.rawPosition})` + }, + { + name: '**@** Mentionable', + value: rRole.mentionable ? 'Yes' : 'No' + }, + { + name: "💡 Display separately", + value: rRole.hoist ? "Yes" : "No" + }, + { + name: "👥 Members", + value: rRole.members.size + }, + { + name: "🔍 Color", + value: `Use ${msg.anyUsage(`color ${rRole.hexColor}`)}` + } + ]) + msg.say(emb) + } +};
\ No newline at end of file diff --git a/src/commands/server/roles.ts b/src/commands/server/roles.ts new file mode 100644 index 0000000..e55f3a8 --- /dev/null +++ b/src/commands/server/roles.ts @@ -0,0 +1,41 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { MessageEmbed } from 'discord.js'; +import tt from '../../utils/truncateText.js' + +module.exports = class RolesServer extends Command { + constructor(client) { + super(client, { + name: 'roles', + aliases: [ + 'list-roles', + 'listroles', + 'roles-list', + 'roleslist' + ], + group: 'fun', + memberName: 'roles', + description: 'Lists all the roles on the current server.', + examples: ['uwu!roles'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + guildOnly: true + }); + } + run(msg: CommandoMessage) { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setTitle('All Roles') + .setDescription(tt( + msg.guild.roles + .cache.sort((role1, role2) => role2.position - role1.position) + .array() + .join(', ') + )) + msg.say(emb) + } +};
\ No newline at end of file diff --git a/src/commands/user/age.ts b/src/commands/user/age.ts new file mode 100644 index 0000000..0ba4515 --- /dev/null +++ b/src/commands/user/age.ts @@ -0,0 +1,40 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { formatDistance, formatRelative } from 'date-fns' +import { stripIndents } from 'common-tags' + +module.exports = class AgeFun extends Command { + constructor(client) { + super(client, { + name: 'age', + aliases: [ + 'account-age', + 'accountage' + ], + group: 'fun', + memberName: 'age', + description: 'Checks when a specified Discord account was created.', + examples: ['uwu!age', 'uwu!age @sin#1337'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'uUser', + prompt: 'Who\'s age would you like to check?', + type: 'user', + default: '' + } + ] + }); + } + async run(msg: CommandoMessage, { uUser }) { + const target = uUser || msg.author + const { createdAt } = target + msg.reply(stripIndents`${formatDistance(createdAt, new Date())} old. + Created on ${formatRelative(createdAt, new Date())}`) + } +};
\ No newline at end of file diff --git a/src/commands/user/id.ts b/src/commands/user/id.ts new file mode 100644 index 0000000..b5d9060 --- /dev/null +++ b/src/commands/user/id.ts @@ -0,0 +1,32 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import { MessageEmbed } from 'discord.js'; + +module.exports = class IDUser extends Command { + constructor(client) { + super(client, { + name: 'id', + group: 'user', + memberName: 'id', + description: 'Tells you the your ID.', + examples: ['uwu!id'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'uUser', + prompt: 'Which user would you like to get the ID of?', + type: 'user', + default: msg => msg.author + } + ] + }); + } + run(msg: CommandoMessage, { uUser }) { + msg.reply(`**${uUser.id === msg.author.id ? 'Your' : `${uUser.username}'s`}** ID is **${uUser.id}**. ${emoji.random()}`) + } +};
\ No newline at end of file diff --git a/src/commands/user/nitro.ts b/src/commands/user/nitro.ts new file mode 100644 index 0000000..1302a0a --- /dev/null +++ b/src/commands/user/nitro.ts @@ -0,0 +1,30 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +import { stripIndents } from 'common-tags' + +module.exports = class NitroUser extends Command { + constructor(client) { + super(client, { + name: 'nitro', + group: 'user', + memberName: 'nitro', + description: 'This message can only be viewed by users with Discord Nitro.', + examples: ['uwu!nitro'], + throttling: { + usages: 5, + duration: 30 + } + }); + } + run(msg: CommandoMessage) { + let emb = new MessageEmbed() + .setColor(0xFFCC4D) + .setAuthor('Discord Nitro', 'https://cdn.discordapp.com/emojis/314068430611415041.png', 'https://discordapp.com/nitro') + .setThumbnail('https://cdn.discordapp.com/emojis/314068430611415041.png') + .setTimestamp(new Date()) + .setDescription(stripIndents` + This message can only be viewed by users with Discord Nitro. + [Lift off with Discord Nitro today](https://discordapp.com/nitro)`) + msg.say(emb) + } +};
\ No newline at end of file diff --git a/src/commands/user/pfp.ts b/src/commands/user/pfp.ts index 6efba76..f4fdee5 100644 --- a/src/commands/user/pfp.ts +++ b/src/commands/user/pfp.ts @@ -39,7 +39,7 @@ module.exports = class PFPServer extends Command { .setColor(0xFFCC4D) .setTitle(`${msg.mentions.users.first()?.username}'s Profile Picture ` + emoji.random()) .setImage(user.avatarURL()) - msg.reply(emb) + msg.say(emb) }) } };
\ No newline at end of file diff --git a/src/commands/utility/average.ts b/src/commands/utility/average.ts new file mode 100644 index 0000000..51ac9e6 --- /dev/null +++ b/src/commands/utility/average.ts @@ -0,0 +1,43 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random' +import { formatDistance, formatRelative } from 'date-fns' +import { stripIndents } from 'common-tags' + +module.exports = class AverageUtility extends Command { + constructor(client) { + super(client, { + name: 'average', + aliases: [ + 'average-number', + 'averagenumber', + 'average-num', + 'averagenum' + ], + group: 'utility', + memberName: 'average', + description: 'Gets the average of specified numbers.', + examples: ['uwu!average 10 20 30 40 50'], + throttling: { + usages: 5, + duration: 30 + }, + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + args: [ + { + key: 'nNum', + prompt: 'What\'s another number you would like to average?', + type: 'float', + label: 'number', + infinite: true + } + ] + }); + } + async run(msg: CommandoMessage, { nNum }) { + if (nNum.length < 2) msg.reply('Please provide **2** or more numbers.') + + const reducer = (accumulator, currentValue) => accumulator + currentValue + msg.reply(`The average of the specified numbers is ${nNum.reduce(reducer) / nNum.length}.` + ' ' + emoji.random()) + } +};
\ No newline at end of file diff --git a/src/commands/utility/csgoserverstatus.ts b/src/commands/utility/csgoserverstatus.ts new file mode 100644 index 0000000..39b5c81 --- /dev/null +++ b/src/commands/utility/csgoserverstatus.ts @@ -0,0 +1,77 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +import emoji from 'emoji-random' +import gamedig from 'gamedig' +import gameDigHelper from '../../utils/gameDigHelper.js' + +module.exports = class CSGOServerStatusUtility extends Command { + constructor(client) { + super(client, { + name: 'csgoserverstatus', + aliases: [ + 'counterstrikeserverstatus', + 'counter-strike-server-status', + 'counterstrikeglobaloffensiveserverstatus', + 'counter-strike-global-offensive-server-status', + 'csgoss' + ], + group: 'utility', + memberName: 'csgoserverstatus', + description: 'Grabs you the server status of a CS:GO server.', + examples: [ + 'uwu!csgoserverstatus', + 'uwu!csgoss' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'host', + prompt: 'What is the IP or host of the server?', + type: 'string' + }, + { + key: 'port', + prompt: 'What is the port of the server?', + type: 'integer', + default: '27015', + max: 65535, + min: 1 + } + ] + }); + } + async run(msg: CommandoMessage, { host, port }) { + try { + const options = { + host, + type: 'csgo' + } + + if (port) { + options.port = port + } + + gamedig + .query(options) + .then(data => { + let emb = gameDigHelper(data) + emb.setColor(0xFFCC4D) + emb.setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/730/header.jpg') + return msg.replyEmbed(emb) + }) + .catch(err => { + if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) + + //console.error(err) + return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) + }) + } finally { + msg.channel.stopTyping() + } + } +};
\ No newline at end of file diff --git a/src/commands/utility/fortnitestats.ts b/src/commands/utility/fortnitestats.ts new file mode 100644 index 0000000..88a50a0 --- /dev/null +++ b/src/commands/utility/fortnitestats.ts @@ -0,0 +1,101 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +import emoji from 'emoji-random' +import axios from 'axios' +import config from '../../config.json' +const platforms = ['pc', 'xbl', 'psn'] + +module.exports = class FortniteStatsUtility extends Command { + constructor(client) { + super(client, { + name: 'fortnitestats', + aliases: [ + 'fortnite-stats', + 'fortnitestatistics', + 'fortnite-statistics', + 'fnstats', + 'fn-stats', + 'fnstatistics', + 'fn-statistics', + 'fns', + 'fn-s' + ], + group: 'utility', + memberName: 'fortnitestats', + description: 'Grabs a specified player\' Fortnite statistics.', + details: 'Available platforms are `pc` (PC), `xbp` (Xbox Live) and `psn` (Playstation Network).', + examples: [ + 'uwu!fortnitestats Frozen', + 'uwu!fns Sin' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'pPlatform', + prompt: 'What platform would you like to search on.', + type: 'string', + parse: platform => platform.toLowerCase(), + oneOf: platforms + }, + { + key: 'pUsername', + prompt: 'What user would you like to look up?', + type: 'string' + } + ] + }); + } + async run(msg: CommandoMessage, { pPlatform, pUsername }) { + try { + const stats = ( + await axios + .get(`https://api.fortnitetracker.com/v1/profile/${pPlatform}/${pUsername}`, { + headers: { 'TRN-Api-Key': config.fortniteTrackerNetworkToken } + }) + .catch(err => { + console.error(err) + return msg.reply('Woops, There was an error with the (https://api.fortnitetracker.com) API. ' + emoji.random()) + }) + ).data + + if (stats.error === 'Player Not Found') { + return msg.reply('Specified player was not found on that platform. ' + emoji.random()) + } + + console.debug(`Result for ${pUsername} on ${pPlatform}:`, stats) + let emb = new MessageEmbed() + .setTitle(stats.epicUserHandle) + .setURL(`https://fortnitetracker.com/profile/${pPlatform}/${encodeURIComponent(pUsername)}`) + .setColor(0xFFCC4D) + .setFooter('Information providied by The Tracker Network.',) + + if (stats.lifeTimeStats[8] && stats.lifeTimeStats[9]) { + emb.addField("🏆 Wins", `${stats.lifeTimeStats[8].value} wins (${stats.lifeTimeStats[9].value})`) + } + + if (stats.lifeTimeStats[10] && stats.lifeTimeStats[11]) { + emb.addField( + "💀 Kills", + `${stats.lifeTimeStats[10].value} kills. ${stats.lifeTimeStats[11].value} K/D ratio.` + ); + } + + if (stats.lifeTimeStats[7]) { + emb.addField("🎮 Matches Played", stats.lifeTimeStats[7].value.toString()); + } + + if (stats.lifeTimeStats[6]) { + emb.addField("🔢 Score", stats.lifeTimeStats[6].value.toString()); + } + + return msg.replyEmbed(emb); + } finally { + msg.channel.stopTyping() + } + } +};
\ No newline at end of file diff --git a/src/commands/utility/gmodserverstatus.ts b/src/commands/utility/gmodserverstatus.ts new file mode 100644 index 0000000..a92b5cf --- /dev/null +++ b/src/commands/utility/gmodserverstatus.ts @@ -0,0 +1,76 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +import emoji from 'emoji-random' +import gamedig from 'gamedig' +import gameDigHelper from '../../utils/gameDigHelper.js' + +module.exports = class GModServerStatusUtility extends Command { + constructor(client) { + super(client, { + name: 'gmodserverstatus', + aliases: [ + 'g-mod-server-status', + 'garrysmodserverstatus', + 'garrys-mod-server-status', + 'gmodss' + ], + group: 'utility', + memberName: 'gmodserverstatus', + description: 'Grabs you the server status of a GMod server.', + examples: [ + 'uwu!gmodserverstatus', + 'uwu!gmodss' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'host', + prompt: 'What is the IP or host of the server?', + type: 'string' + }, + { + key: 'port', + prompt: 'What is the port of the server?', + type: 'integer', + default: '27015', + max: 65535, + min: 1 + } + ] + }); + } + async run(msg: CommandoMessage, { host, port }) { + try { + const options = { + host, + type: 'garrysmod' + } + + if (port) { + options.port = port + } + + gamedig + .query(options) + .then(data => { + let emb = gameDigHelper(data) + emb.setColor(0xFFCC4D) + emb.setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/4000/header.jpg') + return msg.replyEmbed(emb) + }) + .catch(err => { + if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) + + //console.error(err) + return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) + }) + } finally { + msg.channel.stopTyping() + } + } +};
\ No newline at end of file diff --git a/src/commands/utility/iss.ts b/src/commands/utility/iss.ts new file mode 100644 index 0000000..d49b499 --- /dev/null +++ b/src/commands/utility/iss.ts @@ -0,0 +1,31 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import emoji from 'emoji-random'; +import request from 'node-superfetch' + +module.exports = class ISSUtility extends Command { + constructor(client) { + super(client, { + name: 'iss', + aliases: ['internationalspacestation', 'international-space-station'], + group: 'utility', + memberName: 'iss', + description: 'Tells you the current location of the International Space Station.', + examples: ['uwu!iss'], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + }); + } + async run(msg: CommandoMessage) { + try { + const { body } = await request.get('http://api.open-notify.org/iss-now.json') + const pos = body.iss_position + return msg.reply(`The ISS is currentaly at **${pos.latitude}, ${pos.longitude}**. ${emoji.random()}`) + } 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/utility/rustserverstatus.ts b/src/commands/utility/rustserverstatus.ts new file mode 100644 index 0000000..bce83cb --- /dev/null +++ b/src/commands/utility/rustserverstatus.ts @@ -0,0 +1,76 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed } from 'discord.js'; +import emoji from 'emoji-random' +import gamedig from 'gamedig' +import gameDigHelper from '../../utils/gameDigHelper.js' + +module.exports = class RustServerStatusUtility extends Command { + constructor(client) { + super(client, { + name: 'rustserverstatus', + aliases: [ + 'rust-ss', + 'rust-server-status', + 'rustss' + ], + group: 'utility', + memberName: 'rustserverstatus', + description: 'Grabs you the server status of a Rust server.', + examples: [ + 'uwu!rustserverstatus', + 'uwu!rustss' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'host', + prompt: 'What is the IP or host of the server?', + type: 'string' + }, + { + key: 'port', + prompt: 'What is the port of the server?', + type: 'integer', + default: '28015', + max: 65535, + min: 1 + } + ] + }); + } + async run(msg: CommandoMessage, { host, port }) { + try { + const options = { + host, + type: 'rust' + } + + if (port) { + options.port = port + } + + gamedig + .query(options) + .then(data => { + msg.replyEmbed( + gameDigHelper(data) + .setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/252490/header.jpg') + .setColor(0xFFCC4D) + ) + }) + .catch(err => { + if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) + + //console.error(err) + return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) + }) + } finally { + msg.channel.stopTyping() + } + } +};
\ No newline at end of file diff --git a/src/commands/utility/starboundserverstatus.ts b/src/commands/utility/starboundserverstatus.ts new file mode 100644 index 0000000..963f226 --- /dev/null +++ b/src/commands/utility/starboundserverstatus.ts @@ -0,0 +1,95 @@ +import { Command, CommandoMessage } from 'discord.js-commando'; +import { MessageEmbed, Message } from 'discord.js'; +import emoji from 'emoji-random' +import gamedig from 'gamedig' +import gameDigHelper from '../../utils/gameDigHelper.js' + +module.exports = class StarboundServerStatusUtility extends Command { + constructor(client) { + super(client, { + name: 'starboundserverstatus', + aliases: [ + 'starbound-ss', + 'starbound-server-status', + 'sbss' + ], + group: 'utility', + memberName: 'starboundserverstatus', + description: 'Grabs you the server status of a Starbound server.', + examples: [ + 'uwu!starboundserverstatus', + 'uwu!sbss' + ], + userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'], + throttling: { + usages: 5, + duration: 30 + }, + args: [ + { + key: 'host', + prompt: 'What is the IP or host of the server?', + type: 'string' + }, + { + key: 'port', + prompt: 'What is the port of the server?', + type: 'integer', + default: '21025', + max: 65535, + min: 1 + } + ] + }); + } + async run(msg: CommandoMessage, { host, port }) { + try { + const options = { + host, + type: 'starbound' + } + + if (port) { + options.port = port + } + + gamedig + .query(options) + .then(data => { + const curr = data.raw.numplayers + const max = data.maxplayers + + return msg.replyEmbed( + new MessageEmbed() + .setTitle(data.name) + .setThumbnail('https://steamcdn-a.akamaihd.net/steam/apps/211820/header.jpg') + .setFooter(`Took ${data.query.duration} to complete.`) + .addFields([ + { + name: 'IP Address', + value: `${data.query.address} (port ${data.query.port})` + }, + { + name: "Online Players", + value: `${curr}/${max} (${Math.round((curr / max) * 100)}%)` + }, + { + name: "Password Required", + value: data.password ? "Yes" : "No" + } + ]) + .setColor(0xFFCC4D) + ) + }) + .catch(err => { + if (err === 'UDP Watchdog Timeout') return msg.reply('Server timed out, it\'s probably offline. ' + emoji.random()) + + //console.error(err) + return msg.reply('Woops, an unknown error has occured. ' + emoji.random()) + }) + } finally { + msg.channel.stopTyping() + } + } +};
\ No newline at end of file diff --git a/src/config.json b/src/config.json index 07f687f..e015555 100644 --- a/src/config.json +++ b/src/config.json @@ -1,5 +1,8 @@ { "secret":"Njk5NDczMjYzOTk4MjcxNDg5.XpU5oQ.btZuxVudhNllSQY6CxrXXtMJm9A", "yt-api-key":"AIzaSyCeG1lQAeInv4vjFv_eTL9IFAFNdQC9Nk8", - "version":"8.2.0" + "version":"9.0.0", + "fortniteTrackerNetworkToken": "4cf21f95-5f1a-412a-b4a7-e5424adc314a", + "maxMultipler": 100, + "minMultipler": 1.01 }
\ No newline at end of file diff --git a/src/models/Command.ts b/src/models/Command.ts new file mode 100644 index 0000000..a6d6700 --- /dev/null +++ b/src/models/Command.ts @@ -0,0 +1,16 @@ +import { Command } from 'discord.js-commando'; + +module.exports = class UwufierCommand extends Command { + constructor(client, info) { + super(client, info); + + this.argsSingleQuotes = info.argsSingleQuotes || false; + this.throttling = info.throttling || { usages: 1, duration: 2 }; + this.credit = info.credit || []; + this.credit.push({ + name: 'Dragon Fire', + url: 'https://github.com/dragonfire535', + reason: 'Code' + }); + } +}
\ No newline at end of file diff --git a/src/models/commands/Subreddit.ts b/src/models/commands/Subreddit.ts new file mode 100644 index 0000000..ff58a71 --- /dev/null +++ b/src/models/commands/Subreddit.ts @@ -0,0 +1,64 @@ +import { CommandoMessage } from 'discord.js-commando'; +import Command from '../Command.js' +import request from 'node-superfetch' +import emoji from 'emoji-random' + +module.exports = class SubredditCommand extends Command { + constructor(client, info) { + super(client, info); + + this.subreddit = info.subreddit; + this.postType = info.postType ? Array.isArray(info.postType) ? info.postType : [info.postType] : null; + this.getIcon = info.getIcon || false; + this.credit.push({ + name: 'Reddit', + url: 'https://www.reddit.com/', + reason: 'API', + reasonURL: 'https://www.reddit.com/dev/api/' + }); + } + + async run(msg: CommandoMessage, { subreddit }, fromPattern) { + if (fromPattern) subreddit = msg.patternMatches[1]; + if (!subreddit) subreddit = typeof this.subreddit === 'function' ? this.subreddit() : this.subreddit; + try { + const post = await this.random(subreddit, msg.channel.nsfw); + if (!post) return msg.reply('Could not find any results. ' + emoji.random()); + return msg.say(this.generateText(post.post, post.origin, post.icon)); + } catch (err) { + if (err.status === 403) return msg.reply('This subreddit is private. ' + emoji.random()); + if (err.status === 404) return msg.reply('Could not find any results. ' + emoji.random()); + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } + + generateText() { + throw new Error('The generateText method is required.'); + } + + async random(subreddit, nsfw) { + let icon = null; + const { body } = await request + .get(`https://www.reddit.com/r/${subreddit}/hot.json`) + .query({ limit: 100 }); + if (!body.data.children.length) return null; + const posts = body.data.children.filter(post => { + if (!post.data) return false; + if (!nsfw && post.data.over_18) return false; + return (this.postType ? this.postType.includes(post.data.post_hint) : true) && post.data.url && post.data.title; + }); + if (!posts.length) return null; + if (this.getIcon) icon = await this.fetchIcon(subreddit); + return { + origin: subreddit, + post: posts[Math.floor(Math.random() * posts.length)].data, + icon + }; + } + + async fetchIcon(subreddit) { + const { body } = await request.get(`https://www.reddit.com/r/${subreddit}/about.json`); + if (!body.data.icon_img && !body.data.community_icon) return 'https://i.imgur.com/DSBOK0P.png'; + return body.data.icon_img || body.data.community_icon; + } +};
\ No newline at end of file diff --git a/src/utils/Util.ts b/src/utils/Util.ts new file mode 100644 index 0000000..6e00d04 --- /dev/null +++ b/src/utils/Util.ts @@ -0,0 +1,185 @@ +import crypto from 'crypto'; +const yes = ['yes', 'y', 'ye', 'yeah', 'yup', 'yea', 'ya', 'hai', 'si', 'sí', 'oui', 'はい', 'correct']; +const no = ['no', 'n', 'nah', 'nope', 'nop', 'iie', 'いいえ', 'non', 'fuck off']; + +module.exports = class Util { + static delay(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); + } + + static shuffle(array) { + const arr = array.slice(0); + for (let i = arr.length - 1; i >= 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const temp = arr[i]; + arr[i] = arr[j]; + arr[j] = temp; + } + return arr; + } + + static list(arr, conj = 'and') { + const len = arr.length; + if (len === 0) return ''; + if (len === 1) return arr[0]; + return `${arr.slice(0, -1).join(', ')}${len > 1 ? `${len > 2 ? ',' : ''} ${conj} ` : ''}${arr.slice(-1)}`; + } + + static shorten(text, maxLen = 2000) { + return text.length > maxLen ? `${text.substr(0, maxLen - 3)}...` : text; + } + + static randomRange(min, max) { + return Math.floor(Math.random() * (max - min + 1)) + min; + } + + static trimArray(arr, maxLen = 10) { + if (arr.length > maxLen) { + const len = arr.length - maxLen; + arr = arr.slice(0, maxLen); + arr.push(`${len} more...`); + } + return arr; + } + + static removeDuplicates(arr) { + if (arr.length === 0 || arr.length === 1) return arr; + const newArr = []; + for (let i = 0; i < arr.length; i++) { + if (newArr.includes(arr[i])) continue; + newArr.push(arr[i]); + } + return newArr; + } + + static sortByName(arr, prop) { + return arr.sort((a, b) => { + if (prop) return a[prop].toLowerCase() > b[prop].toLowerCase() ? 1 : -1; + return a.toLowerCase() > b.toLowerCase() ? 1 : -1; + }); + } + + static firstUpperCase(text, split = ' ') { + return text.split(split).map(word => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(' '); + } + + static formatNumber(number, minimumFractionDigits = 0) { + return Number.parseFloat(number).toLocaleString(undefined, { + minimumFractionDigits, + maximumFractionDigits: 2 + }); + } + + static base64(text, mode = 'encode') { + if (mode === 'encode') return Buffer.from(text).toString('base64'); + if (mode === 'decode') return Buffer.from(text, 'base64').toString('utf8') || null; + throw new TypeError(`${mode} is not a supported base64 mode.`); + } + + static hash(text, algorithm) { + return crypto.createHash(algorithm).update(text).digest('hex'); + } + + static streamToArray(stream) { + if (!stream.readable) return Promise.resolve([]); + return new Promise((resolve, reject) => { + const array = []; + function onData(data) { + array.push(data); + } + function onEnd(error) { + if (error) reject(error); + else resolve(array); + cleanup(); + } + function onClose() { + resolve(array); + cleanup(); + } + function cleanup() { + stream.removeListener('data', onData); + stream.removeListener('end', onEnd); + stream.removeListener('error', onEnd); + stream.removeListener('close', onClose); + } + stream.on('data', onData); + stream.on('end', onEnd); + stream.on('error', onEnd); + stream.on('close', onClose); + }); + } + + static percentColor(pct, percentColors) { + let i = 1; + for (i; i < percentColors.length - 1; i++) { + if (pct < percentColors[i].pct) { + break; + } + } + const lower = percentColors[i - 1]; + const upper = percentColors[i]; + const range = upper.pct - lower.pct; + const rangePct = (pct - lower.pct) / range; + const pctLower = 1 - rangePct; + const pctUpper = rangePct; + const color = { + r: Math.floor((lower.color.r * pctLower) + (upper.color.r * pctUpper)).toString(16).padStart(2, '0'), + g: Math.floor((lower.color.g * pctLower) + (upper.color.g * pctUpper)).toString(16).padStart(2, '0'), + b: Math.floor((lower.color.b * pctLower) + (upper.color.b * pctUpper)).toString(16).padStart(2, '0') + }; + return `#${color.r}${color.g}${color.b}`; + } + + static today(timeZone) { + const now = new Date(); + now.setHours(0); + now.setMinutes(0); + now.setSeconds(0); + now.setMilliseconds(0); + if (timeZone) now.setUTCHours(now.getUTCHours() + timeZone); + return now; + } + + static tomorrow(timeZone) { + const today = Util.today(timeZone); + today.setDate(today.getDate() + 1); + return today; + } + + static embedURL(title, url, display) { + return `[${title}](${url.replace(/\)/g, '%27')}${display ? ` "${display}"` : ''})`; + } + + static async verify(channel, user, { time = 30000, extraYes = [], extraNo = [] } = {}) { + const filter = res => { + const value = res.content.toLowerCase(); + return (user ? res.author.id === user.id : true) + && (yes.includes(value) || no.includes(value) || extraYes.includes(value) || extraNo.includes(value)); + }; + const verify = await channel.awaitMessages(filter, { + max: 1, + time + }); + if (!verify.size) return 0; + const choice = verify.first().content.toLowerCase(); + if (yes.includes(choice) || extraYes.includes(choice)) return true; + if (no.includes(choice) || extraNo.includes(choice)) return false; + return false; + } + + static cleanAnilistHTML(html) { + let clean = html + .replace(/\r|\n|\f/g, '') + .replace(/<br>/g, '\n') + .replace(/'/g, '\'') + .replace(/"/g, '"') + .replace(/<\/?i>/g, '*') + .replace(/<\/?b>/g, '**') + .replace(/~!|!~/g, '||') + .replace(/—/g, '—'); + if (clean.length > 2000) clean = `${clean.substr(0, 1995)}...`; + const spoilers = (clean.match(/\|\|/g) || []).length; + if (spoilers !== 0 && (spoilers && (spoilers % 2))) clean += '||'; + return clean; + } +};
\ No newline at end of file diff --git a/src/utils/gameDigHelper.ts b/src/utils/gameDigHelper.ts new file mode 100644 index 0000000..647777d --- /dev/null +++ b/src/utils/gameDigHelper.ts @@ -0,0 +1,46 @@ +import ms from "ms"; +import { Util, MessageEmbed } from 'discord.js' + +/** +* Quickly create an embed for a GameDig status using values found in all responses +* @name gamedigHelper +* @param {Object} res Result from GameDig +* @returns {MessageEmbed} +*/ +module.exports = res => { + const playerCount = res.players.length + const maxPlayers = res.maxPlayers + + const emb = new MessageEmbed() + .setTitle(res.name) + .setFooter(`Took ${ms(res.ping)} to complete.`) + .addFields([ + { + name: 'Connect', + value: `${res.connect}` + }, + { + name: 'Online Players', + value: `${playerCount}/${maxPlayers} (${Math.round((playerCount / maxPlayers) * 100)}%)` + }, + { + name: 'Map', + value: Util.escapeMarkdown(res.map) + }, + { + name: 'Password Required', + value: res.password ? 'Yes' : 'No' + } + ]) + + const unconfirmedValues = new Map([ + [res.raw.secure, secure => emb.addField('Vac Secured', secure ? 'Yes' : 'No')], + [res.raw.games, game => emb.addField('Game', Util.escapeMarkdown(game))] + ]) + + unconfirmedValues.forEach((val, key) => { + if (typeof key !== 'undefined') val(key) + }) + + return emb +}
\ No newline at end of file diff --git a/src/utils/genCmdURL.ts b/src/utils/genCmdURL.ts new file mode 100644 index 0000000..4d658bc --- /dev/null +++ b/src/utils/genCmdURL.ts @@ -0,0 +1 @@ +module.exports = cmd => `/commands/${cmd.group.name.toLowerCase().replace(/\s/g, "-")}/${cmd.name}`;
\ No newline at end of file diff --git a/src/utils/simpleFormat.ts b/src/utils/simpleFormat.ts new file mode 100644 index 0000000..0985546 --- /dev/null +++ b/src/utils/simpleFormat.ts @@ -0,0 +1,9 @@ +/** +* @name simpleFormat +* @param {number|string} value Value to format +* @returns {number} A number in fixed-point notation up to 2 decimal points +*/ +module.exports = value => { + const result = parseFloat(parseFloat(value).toFixed(2)); + return result; +};
\ No newline at end of file diff --git a/src/utils/stripWebhookURL.ts b/src/utils/stripWebhookURL.ts new file mode 100644 index 0000000..fa8c240 --- /dev/null +++ b/src/utils/stripWebhookURL.ts @@ -0,0 +1,11 @@ +/** +* Gets the ID and token for a webhook from a webhook URL from the Discord client +* @param {string} url URL for the webhook from the Discord client +* @returns {Object} Object with the webhook ID and token +*/ +module.exports = url => { + const regex = /https:\/\/discordapp\.com\/api\/webhooks\/(\d{1,})\/([\w-_]{1,})/; + const matches = regex.exec(url); + + return { id: matches[1], token: matches[2] }; +};
\ No newline at end of file diff --git a/src/utils/truncateText.ts b/src/utils/truncateText.ts new file mode 100644 index 0000000..bd2f311 --- /dev/null +++ b/src/utils/truncateText.ts @@ -0,0 +1,6 @@ +/** +* @param {string} string String to truncate +* @param {number} [number=2048] Number to truncate to +* @returns {string} Truncated string or original if string was short enough to begin with +*/ +module.exports = (string, number = 2048) => (string.length > number ? `${string.substring(0, number - 3)}...` : string);
\ No newline at end of file diff --git a/src/utils/wait.ts b/src/utils/wait.ts new file mode 100644 index 0000000..bac3b72 --- /dev/null +++ b/src/utils/wait.ts @@ -0,0 +1,6 @@ +/** +* @name wait +* @param {number} delay Delay in milliseconds to wait for +* @returns {Promise<resolve>} +*/ +module.exports = delay => new Promise(resolve => setTimeout(resolve, delay));
\ No newline at end of file diff --git a/src/utils/winPercentage.ts b/src/utils/winPercentage.ts new file mode 100644 index 0000000..022f079 --- /dev/null +++ b/src/utils/winPercentage.ts @@ -0,0 +1,16 @@ +import config from '../config.json' +/** +* @name winPercentage +* @param {number} multiplier Multiplier to calculate win percentage for +* @param {User} user User to calculate win percentage for +* @returns {number} User balance +*/ +module.exports = (multiplier, user) => { + // Load the default setting + //let { houseEdgePercentage } = config; + + // If they're a crown supporter, set it to the patron percentage + //if (config.patrons[user.id] && config.patrons[user.id].crown === true) houseEdgePercentage = 0; + + //return (100 - houseEdgePercentage) / multiplier; +};
\ No newline at end of file |