Compare commits
No commits in common. "d844ac84554e80d33ea15c84c1af09995e68ce5d" and "f44d83c89a664b4013bc58abf9e389a23921ed0b" have entirely different histories.
d844ac8455
...
f44d83c89a
|
@ -1,31 +0,0 @@
|
|||
function diceRoll(side) {
|
||||
|
||||
return Math.ceil(Math.random() * side);
|
||||
|
||||
}
|
||||
module.exports = () => async (ctx) => {
|
||||
|
||||
const numDice = parseInt(ctx.match[1] || "1");
|
||||
const diceSides = parseInt(ctx.match[2]);
|
||||
const rolls = Array(numDice)
|
||||
.fill(0)
|
||||
.map(() => diceRoll(diceSides));
|
||||
const total = rolls.reduce((acc, curr) => acc + curr, 0);
|
||||
const message = rolls
|
||||
.map((i) => `_You roll a_ *D${diceSides}* _and get a_ *${i}*`)
|
||||
.join("\n");
|
||||
let totalMessage = "";
|
||||
if (numDice > 1 || ctx.match[3])
|
||||
totalMessage = `*Total:* ${total}`;
|
||||
|
||||
if (ctx.match[3]) {
|
||||
|
||||
const modifier = parseInt(ctx.match[5]);
|
||||
const sign = ctx.match[4];
|
||||
if (sign === "+") totalMessage += ` + ${modifier} = ${total + modifier}`;
|
||||
else totalMessage += ` - ${modifier} = ${total - modifier}`;
|
||||
|
||||
}
|
||||
ctx.reply(message + "\n\n" + totalMessage, { parse_mode: "Markdown" });
|
||||
|
||||
};
|
|
@ -10,7 +10,6 @@ const info = require("./info");
|
|||
const expand = require("./expand");
|
||||
const roleplay = require("./roleplay");
|
||||
const suggest = require("./suggest");
|
||||
const dice = require("./dice");
|
||||
|
||||
module.exports = (bot, [ questions, kys, insults, commands_list, words, roleplay_data ], feedback_id, apiToken, ugokiRoot, axios) => {
|
||||
|
||||
|
@ -70,7 +69,6 @@ module.exports = (bot, [ questions, kys, insults, commands_list, words, roleplay
|
|||
bot.command("donate", (ctx) => ctx.reply("Thanks for considering to donate."
|
||||
+ " To support the development and hosting of Quadnite Bot, you can "
|
||||
+ "donate here: https://liberapay.com/ceda_ei/"));
|
||||
bot.hears(/(\d*)d(\d+)(\s*([-+])\s*(\d+))?/i, dice());
|
||||
|
||||
function getGetGif(command) {
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "quadnite-bot",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "quadnite-bot",
|
||||
"version": "2.0.0",
|
||||
"version": "1.0.0",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.0",
|
||||
|
|
|
@ -59,15 +59,3 @@ yes
|
|||
help - Need help? Go here
|
||||
feedback - Send feedback, suggestion for kys, insult text
|
||||
rate - Rate me on TGDR
|
||||
|
||||
<b>Dice</b>
|
||||
|
||||
Simply mentioning a dice in a message will send the results
|
||||
|
||||
<code>[num]d[sides] [modifier]</code>
|
||||
|
||||
<i>num</i> is the number of the dices to roll. (Optional)
|
||||
<i>sides</i> is the number of sides of the dice. (Required)
|
||||
<i>modifier</i> is in the form of + or - followed by a number. (Optional)
|
||||
|
||||
<i>Examples</i>: 1d6, 2d10 + 5, 3d20 - 2, 2d20
|
||||
|
|
Loading…
Reference in New Issue