ProjectMoon / matrix-dicebot

This repository is mirrored from: https://git.agnos.is/projectmoon/matrix-dicebot
https://git.agnos.is/projectmoon/matrix-dicebot
Other
4 stars 1 forks source link

Pool roller interpets huge numbers as variable names #21

Closed ProjectMoon closed 3 years ago

ProjectMoon commented 4 years ago

A minor issue with the dice pool roller. It resolves huge numbers (outside the bounds of i32) to variable names, because the resolver simply assumes the value is a variable if it cannot parse an i32. What it should do is check if all the characters in the element are digits, and if so try to parse an i32. If the i32 parse fails, return an error. If the element is not all digits, then we can assume it's a variable name.