Trying to create a timer that sends a message to chat. Compiler says its good but it's not working. function processInlinerolls(msg) {
if (_.has(msg, 'inlinerolls')) {
return _.chain(msg.inlinerolls)
.reduce(function(m, v, k) {
var ti = _.reduce(v.results.rolls, function(m2, v2) {
if (_.has(v2, 'table')) {
m2.push(_.reduce(v2.results, function(m3,
v3) {
m3.push(v3.tableItem.name);
return m3;
}, []).join(', '));
}
return m2;
}, []).join(', ');
m['$[[' + k + ']]'] = (ti.length && ti) || v.results
.total || 0;
return m;
}, {})
.reduce(function(m, v, k) {
return m.replace(k, v);
}, msg.content)
.value();
} else {
return msg.content;
}
} on("chat:message", function(msg) {
if (msg.type === "api" && /^!attr/.test(msg.content)) {
let cmd = processInlinerolls(msg).split(/\s+/);
var who = getObj('player', msg.playerid).get('_displayname')
.split(' ')[0];
var seconds = (Number(cmd[1])) || 0;
var minutes = (Number(cmd[2])) || 0;
var hours = (Number(cmd[3])) || 0;
var time = hours * 3600 + minutes * 60 + seconds;
setTimeout(function() { sendChat(msg.who, "Time's Up!!"); }, time);
}
});