From bb511abc03bb66848947e37a999502b813c77269 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Thu, 23 Jul 2020 23:24:17 -0700 Subject: goodbye old uwufier :cry: --- server/src/commands/anime/Darling.ts | 90 ++++++++++++++++++++++++++++++++++++ server/src/commands/anime/Douse.ts | 27 +++++++++++ server/src/commands/anime/Waifu.ts | 32 +++++++++++++ 3 files changed, 149 insertions(+) create mode 100644 server/src/commands/anime/Darling.ts create mode 100644 server/src/commands/anime/Douse.ts create mode 100644 server/src/commands/anime/Waifu.ts (limited to 'server/src/commands/anime') diff --git a/server/src/commands/anime/Darling.ts b/server/src/commands/anime/Darling.ts new file mode 100644 index 0000000..5b5a7bb --- /dev/null +++ b/server/src/commands/anime/Darling.ts @@ -0,0 +1,90 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import Darling from '../../database/models/DarlingModel'; +import mongoose from 'mongoose'; +import { mongoDBUri } from '../../Config'; +mongoose.connect(mongoDBUri, { + useNewUrlParser: true, + useUnifiedTopology: true +}); + +export default class DarlingAnime extends Command { + public constructor() { + super('darling', { + aliases: ['darling'], + category: 'anime', + description: { + content: 'Allows you to set, check or delete the/ a server\'s darling.', + usage: '[type]', + examples: [ + '', + 'set', + 'remove', + 'check' + ] + }, + ratelimit: 3, + channel: 'guild', + args: [ + { + id: 'type', + type: 'string', + prompt: { + start: 'Would you like to set, check or delete the current darling?', + retries: 3, + retry: 'Sorry, that was not a valid type.' + } + } + ], + userPermissions: ['MANAGE_GUILD'] + }); + } + + public exec(msg: Message, { type }): Promise | any { + const darling = new Darling({ + _id: mongoose.Types.ObjectId(), + username: msg.author.username, + userID: msg.author.id, + guildname: msg.guild.name, + guildID: msg.guild.id, + channelname: msg.channel, + channelID: msg.channel.id, + time: msg.createdAt + }); + + return Darling.findOne({ guildID: msg.guild.id }, async (error, guild) => { + if (error) return console.error(error); + + if (guild) { + if (type === 'remove') { + //@ts-ignore + if (msg.author.id !== guild.userID || msg.author.id !== msg.guild.owner.id) + return msg.reply('Only my darling or the guild owner can remove the current darling.'); + + await Darling.findOneAndDelete({ guildID: msg.guild.id }); + return msg.channel.send('The current darling has been removed!'); + } else if (type === 'set') { + //@ts-ignore + return msg.channel.send(`I already have a darling! It's **${guild.username}**! To set a new darling, either the current darling or the guild owner has to do \`${this.client.commandHandler.prefix}darling remove\`.`); + } else if (type === 'check') { + //@ts-ignore + return msg.channel.send(`My darling is ${guild.username}.`); + } + } else if (!guild) { + if (type === 'remove') { + return msg.channel.send('There is no darling set in this server.'); + } else if (type === 'set') { + await darling.save().catch(err => console.error(err)); + const quotes = [ + 'I think I have taken a liking to you. Won\'t you be my darling?', + 'I like the look in your eyes. It makes my heart race. You are now my darling!', + 'Wow, your taste makes my heart race. It bites and lingers... The taste of danger. You are now my darling!' + ]; + return msg.channel.send(quotes[Math.floor(Math.random() * quotes.length)]); + } else if (type === 'check') { + return msg.reply(`I haven't found my darling yet! To set one, do ${this.client.commandHandler.prefix}darling set.`); + } + } + }); + } +} \ No newline at end of file diff --git a/server/src/commands/anime/Douse.ts b/server/src/commands/anime/Douse.ts new file mode 100644 index 0000000..02b5771 --- /dev/null +++ b/server/src/commands/anime/Douse.ts @@ -0,0 +1,27 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; + +export default class DouseAnime extends Command { + public constructor() { + super('douse', { + aliases: ['douse'], + category: 'anime', + description: { + content: 'Douses Zero Two.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public exec(msg: Message): Promise { + const embed = this.client.util.embed() + .setColor(colour) + .setImage('https://i.pinimg.com/originals/6a/c8/26/6ac826e3d0cbd64eb4f42c12a73fcdb8.gif'); + return msg.channel.send(embed); + } +} \ No newline at end of file diff --git a/server/src/commands/anime/Waifu.ts b/server/src/commands/anime/Waifu.ts new file mode 100644 index 0000000..043b8ac --- /dev/null +++ b/server/src/commands/anime/Waifu.ts @@ -0,0 +1,32 @@ +import { Command } from 'discord-akairo'; +import { Message } from 'discord.js'; +import { colour } from '../../Config'; +import request from 'node-superfetch'; +import Util from '../../utils/Utils'; + +export default class WaifuAnime extends Command { + public constructor() { + super('waifu', { + aliases: ['waifu', 'thiswaifudoesnotexist'], + category: 'anime', + description: { + content: 'Sends a randomly generated waifu with a backstory. WARNING: don\'t get too attatched.', + usage: '', + examples: [ + '' + ] + }, + ratelimit: 3 + }); + } + + public async exec(msg: Message): Promise { + const num = Math.floor(Math.random() * 100000); + const { text } = await request.get(`https://www.thiswaifudoesnotexist.net/snippet-${num}.txt`); + const embed = this.client.util.embed() + .setDescription(Util.shorten(text, 1000)) + .setColor(colour) + .setThumbnail(`https://www.thiswaifudoesnotexist.net/example-${num}.jpg`); + return msg.channel.send(embed); + } +} \ No newline at end of file -- cgit v1.2.3