summaryrefslogtreecommitdiff
path: root/src/commands/zerotwo/darling.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/zerotwo/darling.ts')
-rw-r--r--src/commands/zerotwo/darling.ts60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/commands/zerotwo/darling.ts b/src/commands/zerotwo/darling.ts
new file mode 100644
index 0000000..2c72c1c
--- /dev/null
+++ b/src/commands/zerotwo/darling.ts
@@ -0,0 +1,60 @@
+import { Command, CommandoMessage } from 'discord.js-commando';
+import Darling from '../../models/darling.js';
+import mongo from 'mongoose';
+mongo.connect('mongodb+srv://sin:[email protected]/test?retryWrites=true&w=majority')
+
+module.exports = class DarlingZeroTwo extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'darling',
+ group: 'zerotwo',
+ memberName: 'darling',
+ description: 'Get\'s or sets uwufier\'s current darling.',
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ examples: ['uwu!darling'],
+ args: [
+ {
+ key: 'darlingName',
+ prompt: 'Who should the darling be?',
+ type: 'string',
+ default: ''
+ }
+ ]
+ });
+ }
+ async run(msg: CommandoMessage, { darlingName }) {
+ const darling = new Darling({
+ _id: mongo.Types.ObjectId(),
+ username: msg.author.username,
+ userID: msg.author.id,
+ guildname: msg.guild.name,
+ guildID: msg.guild.id,
+ time: msg.createdAt
+ })
+ const guildExist = await Darling.findOne({ guildID: msg.guild.id })
+
+ if (guildExist && darlingName == 'remove') {
+ await Darling.findOneAndDelete({ guildID: msg.guild.id })
+ msg.say('The current darling has been removed.')
+ } else if (!guildExist && darlingName == 'remove') {
+ msg.reply('There is no darling set in this server.')
+ } else if (darlingName || darlingName == 'set') {
+ await darling.save().then(result => console.log(result)).catch(err => console.log(err))
+
+ var quoteNum = Math.floor((Math.random() * 3) + 1);
+ switch (quoteNum) {
+ case 1: var quoteResult = 'I think I have taken a liking to you. Won\'t you be my darling?'; break
+ case 2: var quoteResult = 'I like the look in your eyes. It makes my heart race. You are now my darling!'; break
+ case 3: var quoteResult = 'Wow, your taste makes my heart race. It bites and lingers... The taste of danger. You are now my darling!'; break
+ default: var quoteResult = 'I think I have taken a liking to you. Won\'t you be my darling?'; break
+ }
+ msg.reply(quoteResult)
+ } else if (!guildExist) {
+ msg.reply('I haven\'t found my darling yet!')
+ } else if (guildExist) {
+ let result = await Darling.findOne({ userID: msg.author.id })
+ msg.reply(`My darling is <@${result.userID}>`)
+ }
+ }
+}; \ No newline at end of file