further-reading / Dicecord-Chatbot

Python based diceroller bot for discord.
GNU General Public License v3.0
9 stars 2 forks source link

Change logic for finding dice amount in a message #6

Closed further-reading closed 5 years ago

further-reading commented 5 years ago

How it works now: Dicecord determines the amount of dice to roll based on the first number mentioned in a message.

@dicecord roll 7 dice -> rolls 7 dice

However, sometimes we want to parse messages differently. For example, to include how we construct our pool:

I have Strength 3 and Athletics 4 so @dicecord roll 7 dice -> rolls 3 dice

Requested change: To allow for better natural language commands, Dicecord will figure out the pool based on the following logic instead:

  1. Find the first number after the roll type command
  2. If no number found, find the first number after the @mention
  3. If no number found, look for text like "x dice"
  4. If no "x dice" found, find the first number mentioned in the message
further-reading commented 5 years ago

I left point 4 out as that can be common without it being the amount for the final roll.