-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.js
37 lines (27 loc) · 923 Bytes
/
plugin.js
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
29
30
31
32
33
34
35
36
37
var droll = require("droll");
var format = require("util").format;
const helps = require('./help');
var TennuDiceRoller = {
init: function(client, imports) {
function roll(IRCMessage){
var rollCommand = IRCMessage.args.join(' ');
var rollResult = droll.roll(rollCommand);
if(!rollResult){
return {
intent: 'notice',
query: true,
message: "Unable to parse dice roll formula."
};
}
return format("Rolling %s | Results: %s, (%s)", rollCommand, rollResult.rolls.join(", "), rollResult.total);
}
return {
handlers: {
"!droll !dr": roll,
},
commands: ["droll"],
help: helps
};
}
};
module.exports = TennuDiceRoller;