aboutsummaryrefslogtreecommitdiff
path: root/death.js
blob: bb694fe7c5b5b4f51e9e3bc1dfcc7ead01c0794d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const util = require("util")
const google_images = require("free-google-images")
const common = require("./common.js")

const kill_deathmessages = require("./kill_deathmessages.json")
const deathmessages = require("./deathmessages.json")

module.exports = {
	kill: {
		func: (msg, [targetPing]) => {
			const user = msg.author.id
			const target = common.getPing(msg, targetPing, true)

			if (target)
				google_images.searchRandom("kill+meme")
					.then(result => msg.channel.send((target == user
						? `<@!${target}> died due to lack of friends.`
						: util.format(common.choose(kill_deathmessages), `<@!${target}>`, `<@!${user}>`)
					) + `\n${result.image.url}`))
		}
	},
	die: {
		func: msg => {
			google_images.searchRandom("die+meme")
				.then(result => msg.channel.send(util.format(common.choose(deathmessages), `<@!${msg.author.id}>`) + `\n${result.image.url}`))
		}
	},
}