70 lines
2.9 KiB
JavaScript
70 lines
2.9 KiB
JavaScript
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const builders_1 = require("@discordjs/builders");
|
||
|
const discord_js_1 = require("discord.js");
|
||
|
const rand = require('random-seed').create();
|
||
|
const results = [
|
||
|
['Vigilante', 'Veteran', 'Mafioso', 'Ambusher'],
|
||
|
['Medium', 'Janitor', 'Retributionist'],
|
||
|
['Survivor', 'Vampire Hunter', 'Amnesiac'],
|
||
|
['Spy', 'Blackmailer', 'Jailor'],
|
||
|
['Sheriff', 'Executioner', 'Werewolf'],
|
||
|
['Framer', 'Vampire', 'Jester'],
|
||
|
['Lookout', 'Forger', 'Witch'],
|
||
|
['Escort', 'Transporter', 'Consort', 'Hypnotist'],
|
||
|
['Doctor', 'Disguiser', 'Serial Killer'],
|
||
|
['Investigator', 'Consigliere', 'Mayor'],
|
||
|
['Bodyguard', 'Godfather', 'Arsonist']
|
||
|
];
|
||
|
function seperate(l) {
|
||
|
return l.slice(0, -1).join(', ') + ' or ' + l.slice(-1);
|
||
|
}
|
||
|
module.exports = {
|
||
|
data: new builders_1.SlashCommandBuilder()
|
||
|
.setName('investigate')
|
||
|
.setDescription('Investigate someone.')
|
||
|
.addUserOption((option) => option.setName('who').setDescription('Investigate who?').setRequired(true))
|
||
|
.addBooleanOption((option) => option.setName('sheriff').setDescription('Switch to Sheriff-style investigation').setRequired(false)),
|
||
|
execute: async (interaction, member) => {
|
||
|
let who = interaction.options.getUser('who');
|
||
|
let sheriff = interaction.options.getBoolean('sheriff');
|
||
|
let response;
|
||
|
let color;
|
||
|
if (who.id === member.id) {
|
||
|
response = `You decided to investigate yourself tonight. The only thing you've found out this night is that this is a waste of time.`;
|
||
|
color = 0x333333;
|
||
|
}
|
||
|
else {
|
||
|
if (sheriff) {
|
||
|
rand.seed(who.id);
|
||
|
const good = rand.random() > 0.4;
|
||
|
if (good) {
|
||
|
response = `You decided to investigate **${who.username}** tonight.\n_You cannot find evidence of wrongdoing. Your target seems innocent._`;
|
||
|
color = 0x55ff55;
|
||
|
}
|
||
|
else {
|
||
|
response = `You decided to investigate **${who.username}** tonight.\n_Your target is suspicious!_`;
|
||
|
color = 0xff3333;
|
||
|
}
|
||
|
}
|
||
|
else {
|
||
|
rand.seed(who.id);
|
||
|
let result = results[rand.range(results.length)];
|
||
|
response = `You decided to investigate **${who.username}** tonight.\nYour target could be a ${seperate(result.map(r => '**' + r + '**'))}.`;
|
||
|
color = 0x444444;
|
||
|
}
|
||
|
}
|
||
|
const embed = new discord_js_1.MessageEmbed()
|
||
|
.setDescription(response)
|
||
|
.setAuthor({
|
||
|
name: `${member.displayName} the ${sheriff ? 'Sheriff' : 'Investigator'}`,
|
||
|
iconURL: member.displayAvatarURL()
|
||
|
})
|
||
|
.setColor(color);
|
||
|
await interaction.reply({
|
||
|
embeds: [embed],
|
||
|
ephemeral: true,
|
||
|
});
|
||
|
}
|
||
|
};
|