actions.action_play_rps

Custom action for playing rock-paper-scissors.

Module Contents

Classes

ActionPlayRPS

Attributes

CHOICES

actions.action_play_rps.CHOICES = ['rock', 'paper', 'scissors']
class actions.action_play_rps.ActionPlayRPS

Bases: rasa_sdk.Action

name() Text
computer_choice() Text

Returns a random choice between ‘rock’, ‘paper’, and ‘scissors’.

run(dispatcher: rasa_sdk.executor.CollectingDispatcher, tracker: rasa_sdk.Tracker, domain: Dict[Text, Any]) List[Dict[Text, Any]]

Plays a round of ‘rock’, ‘paper’, ‘scissors’ given user choice stored in the ‘choice’ slot.

Parameters
  • dispatcher – Class responsible for sending messages back to user.

  • tracker – Class that maintains the state of a conversation.

  • domain – Dictionary containing information stored in ‘domain.yml’