fix(dice): handle missing dice roll parameter

Adjust exception handling to catch both ValueError and IndexError. This ensures the command gracefully defaults to 6 sides when input parameters are insufficient or improperly formatted. Improves robustness against user errors.
This commit is contained in:
Kumi 2024-08-18 10:54:03 +02:00
parent 525aea3f05
commit 08fa83f1f9
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -9,7 +9,7 @@ async def command_dice(room: MatrixRoom, event: RoomMessageText, bot):
try:
sides = int(event.body.split()[2])
except ValueError:
except (ValueError, IndexError):
sides = 6
if sides < 2: