[nodebb-plugin-dice-and-numbers] Roll dice and generate random numbers

• Built to work in the default composer. Not much css attached, but it should be pretty easy to make it look however you like.

Adds a button that opens a panel where you can select if you'd like to roll XdX dice or generate X random numbers within a range of X to X.
Results are visible in posts like this:

Results are also not editable in posts after they are rolled.

Still kinda wip but no guarantee I'll work on it further, since it does what I want for my own forum.

known weirdness:
if you have a thread where the last post has a dice roll in it, and that post hasn't been edited for a few months, the value can disappear. re-editing the post makes the value appear again.

• Hey @am1cable! Very cool plugin. I started using it on my forum and it started generating errors. Not sure if you are still putting work into this thing, but thought you should know!

Here's the output:

2019-10-21T19:34:24.718Z [4567/17167] - error: uncaughtException: Cannot read property 'toString' of undefined
TypeError: Cannot read property 'toString' of undefined
at Object.parsePost [as method] (/var/www/html/community/node_modules/nodebb-plugin-dice-and-numbers/library.js:22:193)
at /var/www/html/community/src/plugins/hooks.js:136:12
at /var/www/html/community/node_modules/async/dist/async.js:2516:9
at replenish (/var/www/html/community/node_modules/async/dist/async.js:1011:17)
at iterateeCallback (/var/www/html/community/node_modules/async/dist/async.js:995:17)
at /var/www/html/community/node_modules/async/dist/async.js:969:16
at /var/www/html/community/node_modules/async/dist/async.js:2518:13
at parse (/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js:155:9)
at getTable (/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js:141:9)
tail: './logs/output.log' has become inaccessible: No such file or directory
tail: './logs/output.log' has appeared;  following new file
at async_1.parallel (/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js:59:9) {"error":{},"stack":"TypeError: Cannot read property 'toString' of undefined\n    at Object.parsePost [as method] (/var/www/html/community/node_modules/nodebb-plugin-dice-and-numbers/library.js:22:193)\n    at /var/www/html/community/src/plugins/hooks.js:136:12\n    at /var/www/html/community/node_modules/async/dist/async.js:2516:9\n    at replenish (/var/www/html/community/node_modules/async/dist/async.js:1011:17)\n    at iterateeCallback (/var/www/html/community/node_modules/async/dist/async.js:995:17)\n    at /var/www/html/community/node_modules/async/dist/async.js:969:16\n    at /var/www/html/community/node_modules/async/dist/async.js:2518:13\n    at parse (/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js:155:9)\n    at getTable (/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js:141:9)\n    at async_1.parallel (/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js:59:9)","exception":true,"date":"Mon Oct 21 2019 19:34:24 GMT+0000 (Coordinated Universal Time)","process":{"pid":17167,"uid":1000,"gid":1000,"cwd":"/var/www/html/community","execPath":"/usr/local/bin/node","version":"v11.4.0","argv":["/usr/local/bin/node","/var/www/html/community/app.js"],"memoryUsage":{"rss":214982656,"heapTotal":111153152,"heapUsed":90999224,"external":2162539329}},"os":{"loadavg":[0.19677734375,0.3017578125,0.2587890625],"uptime":52370587},"trace":[{"column":193,"file":"/var/www/html/community/node_modules/nodebb-plugin-dice-and-numbers/library.js","function":"Object.parsePost [as method]","line":22,"method":"parsePost [as method]","native":false},{"column":12,"file":"/var/www/html/community/src/plugins/hooks.js","function":null,"line":136,"method":null,"native":false},{"column":9,"file":"/var/www/html/community/node_modules/async/dist/async.js","function":null,"line":2516,"method":null,"native":false},{"column":17,"file":"/var/www/html/community/node_modules/async/dist/async.js","function":"replenish","line":1011,"method":null,"native":false},{"column":17,"file":"/var/www/html/community/node_modules/async/dist/async.js","function":"iterateeCallback","line":995,"method":null,"native":false},{"column":16,"file":"/var/www/html/community/node_modules/async/dist/async.js","function":null,"line":969,"method":null,"native":false},{"column":13,"file":"/var/www/html/community/node_modules/async/dist/async.js","function":null,"line":2518,"method":null,"native":false},{"column":9,"file":"/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js","function":"parse","line":155,"method":null,"native":false},{"column":9,"file":"/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js","function":"getTable","line":141,"method":null,"native":false},{"column":9,"file":"/var/www/html/community/node_modules/nodebb-plugin-emoji/build/lib/parse.js","function":"async_1.parallel","line":59,"method":"parallel","native":false}]}


• @Michael-Pfaff I haven't been working on it recently, but I have plans to go through and finish it sometime this year. Will have a look at this while I'm at it!

• @Michael-Pfaff I haven't been working on it recently, but I have plans to go through and finish it sometime this year. Will have a look at this while I'm at it!

Hey man, I just went ahead and purchased a plugin made by the NodeBB team. We made it open source if you wanna use that.

It's here for anyone interested: https://github.com/NodeBB/nodebb-plugin-dice

3

3

2

2

3
| |