First second version of an older bot. Warning: Bad code ahead.
Want it in your server? Just use this link to add it. Only the Read Messages and Send Messages permissions are currently used, the others are just there in case I feel like using them later for any reason. None of these require 2FA or are administrative in nature.
Note that I don't currently implement sharding at all. It's on the cards, but will require a more abstracted gateway approach.
See it in your server? Just mention it and go nuts - the main version of this is running as @dbag#7193. Any message mentioning the bot is logged, even if it's 100% erroneous, so feel free to put suggestions to me that way if you got 'em. I promise to check the logs if it crashes. You should try to make it do that, too.
Use {count}d{sides}{mutations} for rolling dice, such as 11d10 (note that results, if output as a list, are sorted in descending order). The following mutations are supported:
kh{count}Keep the highestcountdice of the roll:2d20kh1kl{count}Keep the lowestcountdice of the roll:2d20kl1ka{target}Keep all dice which rolled greater than or equal totarget:11d10ka7kb{target}Keep all dice which rolled belowtarget:11d10kb7saSort the results in ascending order:2d20sasdSort the results in descending order:2d20sdssSort the results into sets:11d10ss
Raw numbers and dice rolls can intermingle with arithmetic operators, which will be evaluated using in the below order. Note that performing arithmetic on any dice result will sum it automatically, and never apply changes to each die.
^Exponential*Multiplication/Division+Addition-Subtraction%Modulus (why not?)
Parentheses can stack your inputs, exactly as you'd expect. Prefixes can also modify how the parentheses resolve - the following are supported:
sum({input})Sum up all dice in the resulting array. Implicit - if you do anything other than finalize a roll with a set of dice, it will be summed.count({input})Return the count of dice rolled. Useful for successes, as incount(12d6ka5)to count dice rolling 5 or 6. Of course, doing this manually is probably desirable in most systems, since other results may be important.
Create an application and put its bot token in the same directory as main.js, in a file named only token and with no whitespace. Then simply invoke the name of the demon which is nodeJS upon it, and it should run. It might not. Who can really know?