Rolisteam / DiceParser

Powerful dice Roller is used as discord bot, irc bot, cli tool and inside Rolisteam : 1d20+4, 1L[head,arm,leg,belly,chest], 1d6+1d8, 8+5*3
http://www.rolisteam.org/
GNU General Public License v3.0
125 stars 31 forks source link

Tag Discord User In Response #106

Closed CDixon44 closed 3 years ago

CDixon44 commented 3 years ago

When a Discord user calls for a roll it would be helpful for the DiceParser to @mention the user in the response to clearly identify who the response is meant for. This way if several users call for rolls at the same time the responses are easily distinguishable from each other. I think your product is great and that this enhancement would be a relatively easy way to make it even more helpful.

Here is an example of the output I'm thinking of: DiceParser_Example_Discord_Reponse

obiwankennedy commented 3 years ago

You can already do that.

!1d20 # $user

The command above will have the exact output you want. It is easier to set alias to roll a dice for your game and make sure the # $user is inside the command.

For example, you can define:

!macro add dd "d20 # $user" False

So, your users can now type 2dd to roll 2d20 # $user Of course, send dd command will mean: "d20 # $user` which is also a working.

If you are using several kind of dice and don't want to set game specific macro. I strongly recommand to use at least one macro:

!macro add (.*) "\1 # $user" True

This macro will add # $user at the end of any dice command rolled on your server. That's all!

CDixon44 commented 3 years ago

First of all, thank you for your response it was very helpful. I just have a quick follow-up question though, in the 1st image I added below you can see the results of the macro you gave me !macro add (.*) "\1 # $user" True which is exactly what I wanted except it has the trailing # $user which I wasn't expecting. Is that expected behavior or is there a tweak that can be made to the macro to remove that part of the response so it looks more like the 2nd image?

Example of current output: DiceParser_Example_Discord_Reponse_1

Example of desired output: DiceParser_Example_Discord_Reponse_2

obiwankennedy commented 3 years ago

It is probably a glitch in the generic macro. It could be improve to fix it. I'm working on it.

If you roll !2d4 # $user it is perfect.

Podlewski commented 3 years ago

This macro works better: !macro add (..*) "\1 # $user" True Using one dot with asterisk requires no character to invoke macro. By adding one dot to regex group we will stop invoking it extra time on hidden macro with 0 chars. Or this may be something releated to bot activating after #. Or even both... I am not sure, but for now this solves problem (requires future testing, what for sure I will be doing).

But IMO this is just band-aid fix. Adding option to turn on and off showing nicknames would be lovely (with posibbility to mention or not mention user).

Anyways, I really appreciate what you are doing with this bot. Keep up with good work!

ValeTheVioletMote commented 3 years ago

Here's a macro I developed:

!macro add ^r\s*([^#\n\r]+)(?:#(.+))? "\1# $user \2" True

It checks for !r at the start, and even lets you still comment!

obiwankennedy commented 3 years ago

Just deploy new version of diceparser.

You can configure that from the command conf. more details: !help conf

ValeTheVioletMote commented 3 years ago

@obiwankennedy

For conf... It doesn't say in the help to use "set"

Also, it lists "displayMode" as "DisplayMode"

But major thanks for adding this feature!!!

Podlewski commented 3 years ago

Oh, missed this notification, but just saw during marco update. Great stuff! Hope that more users will see it after HelpMe.md update :3

There is small problem with capital letters, as in example there is Yes, but only yes works 😅