Sha256: 9ab78018c22618d2808492d7af2724ea9ec2b8cd914fdbb5a40c9e2b68c4cf0c
Contents?: true
Size: 1.11 KB
Versions: 5
Compression:
Stored size: 1.11 KB
Contents
module Commands # You can write all your commands as methods here # If the command is bound with reply_with specified, # you have to deal with user response to the last message and react on it. def start_conversation # Quick replies are accessible through message object's quick_reply property, # by default it's the quick reply text in ALL CAPS # you can also react on the text itself message.typing_on case message.quick_reply when 'OK' say "Glad you're doing well!" stop_thread when 'NOT_OK' say "Too bad. What happened?" next_command :appear_nice else say "🤖" # it's always a good idea to have an else, quick replies don't # prevent user from typing any message in the dialogue stop_thread end message.typing_off end def appear_nice message.typing_on case message.text when /job/i then say "We've all been there" when /family/i then say "That's just life" else say "It shall pass" end message.typing_off stop_thread # future messages from user will be handled from top-level bindings end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rubotnik-0.2.3 | templates/commands.rb |
rubotnik-0.2.2 | templates/commands.rb |
rubotnik-0.2.1 | templates/commands.rb |
rubotnik-0.2.0 | templates/commands.rb |
rubotnik-0.1.1 | templates/commands.rb |