Skip to content

Commit

Permalink
Merge pull request #17 from navigatorframework/fix/correct-chances-flow
Browse files Browse the repository at this point in the history
fix: correct chances flow
  • Loading branch information
elementh authored Aug 22, 2024
2 parents b5a48de + c86f669 commit 5eb75aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Inside the AddNavigator method you can define the following options:
- Optionally, allow multiple actions for the same update: `options.EnableMultipleActionsUsage()`
- Optionally, enable the sending of chat actions (e.g. typing) notifications: `options.EnableChatActionNotification()`

Continue by defining the actions of your bot using the different helper methods (see source code for more details). Here is a short example:
Continue by defining the actions of your bot using the different helper methods (see source code for more details).

Finally add the following line to map the endpoint to the navigator framework:

Expand Down Expand Up @@ -89,7 +89,7 @@ by the Free Software Foundation, either version 3 of the License, or
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
2 changes: 1 addition & 1 deletion src/Navigator/Strategy/NavigatorStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private async IAsyncEnumerable<BotAction> FilterActionsThatCanHandleUpdate(IEnum
/// <param name="update">The <see cref="Update" /> object that triggered the execution of the <see cref="BotAction" />.</param>
private async Task ExecuteAction(BotAction action, Update update)
{
if (action.Information.Chances is not null && Random.Shared.NextDouble() < action.Information.Chances)
if (action.Information.Chances is not null && Random.Shared.NextDouble() > action.Information.Chances)
{
_logger.LogDebug("Discarding action {ActionName} because of configured chances ({Chances})", action.Information.Name,
action.Information.Chances);
Expand Down

0 comments on commit 5eb75aa

Please sign in to comment.