Skip to content

Commit 6301b9f

Browse files
committed
Marriage system base
#15
1 parent ac8a18b commit 6301b9f

File tree

4 files changed

+127
-1
lines changed

4 files changed

+127
-1
lines changed

commands/divorce.js

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
exports.run = async (client, message, args) => {
2+
client.life.ensure(message.author.id, {
3+
member: message.author.id,
4+
spouse: 0,
5+
job: 0
6+
})
7+
8+
const spouse = client.life.get(message.author.id, 'spouse')
9+
if (spouse === 0) return message.channel.send('You need to have a spouse before you can divorce them.')
10+
11+
if (args[0] === 'confirm') {
12+
message.channel.send('You divorced your partner.')
13+
client.life.set(message.author.id, 0, 'spouse')
14+
client.life.set(spouse, 0, 'spouse')
15+
}
16+
17+
else {
18+
message.channel.send('You are about to divorce your partner. Type ;;divorce confirm to confirm this action.')
19+
}
20+
}
21+
22+
exports.conf = {
23+
enabled: true,
24+
aliases: ['div', 'fixyourlife'],
25+
guildOnly: true,
26+
permLevel: 'User'
27+
}
28+
29+
exports.help = {
30+
name: 'divorce',
31+
category: 'Fun',
32+
description: 'Divorces your spouse.',
33+
usage: 'divorce'
34+
}

commands/info.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ exports.run = async (client, message, args, level) => { // eslint-disable-line n
55
try {
66
const member = message.mentions.members.first()
77
let user = ''
8-
if (member) user = message.mentions.members.first()
8+
if (member) user = message.mentions.members.first().user
9+
if (user.bot === true) return message.channel.send('Now why would you want to do that?')
910
if (!member) user = message.author
1011

1112
client.life.ensure(user.id, {

commands/marry.js

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
const Discord = require('discord.js')
2+
const colors = require('../lib/colors.json')
3+
4+
exports.run = async (client, message, args) => {
5+
const user = message.mentions.users.first() || client.users.get(args[0])
6+
if (!user) return message.channel.send('You must mention someone or give their ID!')
7+
if (user.bot === true) return message.channel.send('Don\'t marry bots. They have no feelings... trust me...')
8+
if (user === message.author || message.author.id === user.id) return message.channel.send('It really do be like that sometimes...')
9+
10+
let proposerID = message.author.id
11+
let proposerName = message.author.username
12+
13+
client.life.ensure(user.id, {
14+
member: user.id,
15+
spouse: 0,
16+
job: 0
17+
})
18+
19+
client.life.ensure(message.author.id, {
20+
member: message.author.id,
21+
spouse: 0,
22+
job: 0
23+
})
24+
25+
client.inventory.ensure(message.author.id, {
26+
member: message.author.id,
27+
rings: 0,
28+
petfood: 0,
29+
seeds: 0,
30+
})
31+
32+
const rings = client.inventory.get(message.author.id, 'rings')
33+
const spouse = client.life.get(message.author.id, 'spouse')
34+
const uSpouse = client.life.get(user.id, 'spouse')
35+
36+
if (rings === 0) return message.channel.send('You do not have a wedding ring. Buy one in the shop.')
37+
if (spouse !== 0) return message.channel.send('You cannot have more than one spouse.')
38+
if (uSpouse !== 0) return message.channel.send(`${user.tag} already has a spouse.`)
39+
40+
let embed = new Discord.RichEmbed()
41+
.setDescription(`**${user.tag}**, **${message.author.tag}** is asking for your hand in marriage, would you like to accept?`)
42+
43+
const noEmoji = message.client.emojis.get('637573919204966410')
44+
message.channel.send(embed).then(message => {
45+
message.react('✅').then(() => message.react(noEmoji));
46+
47+
const filter = (reaction, sent) => {
48+
return ['✅', noEmoji].includes(reaction.emoji.name) && sent.id === user.id;
49+
};
50+
51+
const proposer = message.guild.members.get("id", proposerID)
52+
53+
message.awaitReactions(filter, { max: 1, time: 60000, errors: ['time'] })
54+
.then(collected => {
55+
const reaction = collected.first()
56+
57+
if (reaction.emoji.name === '✅') {
58+
client.life.set(proposerID, user.id, 'spouse')
59+
client.life.set(user.id, proposerID, 'spouse')
60+
client.inventory.set(proposerID, rings - 1, 'rings')
61+
62+
embed.setDescription(`${user.tag} and ${proposer.user.tag} are now married`)
63+
.setImage('https://media.giphy.com/media/vTfFCC3rSfKco/giphy.gif')
64+
.setColor(colors.pink)
65+
message.channel.send(embed)
66+
}
67+
if (reaction.emoji.id === '637573919204966410') { // No emoji
68+
embed.setTitle(`Sorry **${proposer.user.tag}**, **${user.tag}** declined your proposal.`)
69+
message.edit(embed)
70+
}
71+
})
72+
.catch(collected => {
73+
message.channel.send(`Sorry ${proposer.user.tag}, the person you proposed to didn't respond, try again later.`)
74+
});
75+
})
76+
}
77+
78+
exports.conf = {
79+
enabled: true,
80+
aliases: ['propose', 'preparetoruinyourlife'],
81+
guildOnly: true,
82+
permLevel: 'User'
83+
}
84+
85+
exports.help = {
86+
name: 'marry',
87+
category: 'Fun',
88+
description: 'Proposes to <member>.',
89+
usage: 'marry <member>'
90+
}

lib/colors.json

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"blue": "#3498DB",
55
"teal": "#4699AA",
66
"purple": "#995BBD",
7+
"pink": "#F784D9",
78
"default": "#995BBD"
89
}

0 commit comments

Comments
 (0)