Sends a random Minecraft death message via !mckill, if you @ someone after the command like !mckill @ROLD_GOLD it will send a message saying {PERSON} killed ROLD_GOLD but if you just use !mckill it will send a self death like ROLD_GOLD fell from a high place :)
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
const author = context.params.event.mentions.length
? context.params.event.mentions[0]
: context.params.event.author;
let deathmsgs = [
`was shot by`,
`was pummeled by`,
`was squashed by a falling anvil whilst fighting`,
`was blown up by`,
`was impaled on a stalagmite whilst fighting`,
`was squashed by a falling block whilst fighting`,
`was skewered by a falling stalactite whilst fighting`,
`walked into fire whilst fighting`,
`was burnt to a crisp whilst fighting`,
`went off with a bang due to a firework fired from firework by`,
`tried to swim in lava to escape`,
`was struck by lightning whilst fighting`,
`walked into danger zone due to`,
`was killed by magic whilst trying to escape`,
];
let selectedDeathMsg = Math.floor(Math.random() * deathmsgs.length);
let deathmsg = deathmsgs[selectedDeathMsg];
let selfdeaths = [
`was pricked to death`,
`drowned`,
`blew up`,
`experienced kinetic energy`,
`hit the ground too hard`,
`fell from a high place`,
`fell of a ladder`,
`fell off some vines`,
`was impaled on a stalagmite`,
`was squashed by a falling anvil`,
];
let selectedSelfDeath = Math.floor(Math.random() * selfdeaths.length);
let selfdeath = selfdeaths[selectedSelfDeath];
await lib.discord.channels['@0.1.2'].messages.create({
channel_id: context.params.event.channel_id,
content:
author.username === context.params.event.author.username
? `${author.username} ${selfdeath}`
: `${author.username} ${deathmsg} ${context.params.event.author.username}`,
});