Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TelegramDiceRoller

I made a bot for Telegram that allows you to make more complex rolls than the standard Roll'emBot.
The bot might still have a few bugs because I didn't spend that much time debugging it, so use it on your own risk.
You can copy the code to your machine, generate a new bot_id with bot father and create your own diceBot. You can also just copy the compiler/lexer and classes and use it with any python program, just make the calls to the compiler.

Explaining the roll command:

Use 'xdy' to roll x y-sided dice and sum their values. 'dy' rolls 1 y-sided die.
Ex: '/roll 2d6' will roll 2 6-sided dice.

Use 'l'/'L' or 'h'/'H' to refer to the lowest or highest rolls of a set respectively
Ex: '/roll 2d6-H' will roll 2 6-sided dice and remove the highest value.

You can make operations like '+', '-', '*' and '/'
Ex: '/roll 2d6+1d8 * 1d4' will roll 2 6-sided dice, sum their values, then roll 1 8-sided die and 1 4-sided die, multiply the last 2 results and sum with the 2d6 result.

You can nest expressions. Parenthesis are optional (but sometimes they change the priorities) and die operations have the highest priority.
Ex: '/roll 1d6d8' will roll 1d6 and roll d8's equal to the result of the 1d6.
Ex: '/roll 1d(6d8)' will roll 6d8 and then take the result to make '1d(result)'
Ex: '/roll 1+2*1d6' will roll first, then multiply and then sum.

'L' and 'H' always refers to the last set of rolls.
Ex: In '/roll 2d6d4-H' the H refers to a dice in the roll of the d4s and not the d6s.

The bot can't handle negatives and float numbers. Any negative rolls return 0. Float values are floored.
Ex: '/roll 1d(0-2)' will result in rolling a 1d(-2) and 0 as result.
Ex: '/roll 1d(5/2)' will result in rolling a 1d(2.5) that becomes 1d2.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages