1 const common = require("./common.js")
2 const google_images = require("free-google-images")
3 let marriages = common.storageLoad("marriages") || {}
6 marry: common.requestCommand("marry another user", (msg, target) => {
7 const origin = msg.author.id
10 return `You are already married to <@!${marriages[origin]}>.`
11 else if (marriages[target])
12 return `<@!${target}> is already married to <@!${marriages[target]}>.`
14 msg.channel.send(`<@!${target}>: <@!${origin}> is proposing to you. Type !accept to accept or !deny to deny.`)
16 const target = msg.author.id
18 google_images.searchRandom("wedding")
19 .then(result => msg.reply(`Congratulations, <@!${target}> & <@!${origin}>, you are married. You may now kiss \\:)\n${result.image.url}`))
21 marriages[origin] = target
22 marriages[target] = origin
23 common.storageSave("marriages", marriages)
27 const user = msg.author.id
28 const partner = marriages[user]
31 delete marriages[user]
32 delete marriages[partner]
33 common.storageSave("marriages", marriages)
35 msg.reply(`<@!${user}> divorced from <@!${partner}>.`)
37 msg.reply("You are not married.")
42 func: (msg, [targetPing]) => {
43 const user = msg.author.id
44 const target = targetPing ? common.getPing(msg, targetPing, true) : user
47 const partner = marriages[target]
48 const are = user == target ? "You are" : `<@!${target}> is`
51 msg.reply(are + ` married to <@!${partner}>.`)
53 msg.reply(are + " not married.")