la-cosa-nostra
Version:
A Mafia bot designed to run in Discord - beware the traitors and the lies!
30 lines (21 loc) • 863 B
JavaScript
var rs = require("../../../rolesystem/rolesystem.js");
var auxils = require("../../../systems/auxils.js");
module.exports = function (actionable, game, params) {
var visit_log = game.actions.visit_log;
var visitor_names = new Array();
for (var i = 0; i < visit_log.length; i++) {
if (visit_log[i].target === actionable.to) {
// Target
var visitor = game.getPlayerByIdentifier(visit_log[i].visitor);
visitor_names.push("**" + visitor.getDisplayName() + "**");
};
};
var lookout = game.getPlayerByIdentifier(actionable.from);
visitor_names.sort();
if (visitor_names.length > 0) {
var message = ":eye: " + auxils.pettyFormat(visitor_names) + " visited your target last night.";
game.addMessage(lookout, message);
} else {
game.addMessage(lookout, ":eye: Nobody visited your target last night.");
};
};