Class: Daneel::Scripts::Chatty
- Inherits:
-
Daneel::Script
- Object
- Plugin
- Daneel::Script
- Daneel::Scripts::Chatty
- Defined in:
- lib/daneel/scripts/chatty.rb
Instance Attribute Summary
Attributes inherited from Plugin
Instance Method Summary collapse
-
#receive(room, message, user) ⇒ Object
TODO make this script the last-priority script priority 20.
Methods inherited from Daneel::Script
#accepts?, files, #help, inherited, list
Methods inherited from Plugin
#initialize, #logger, requires_env
Constructor Details
This class inherits a constructor from Daneel::Plugin
Instance Method Details
#receive(room, message, user) ⇒ Object
TODO make this script the last-priority script priority 20
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/daneel/scripts/chatty.rb', line 9 def receive(room, , user) # Said to the room in general case .text when /^(night|good ?night)(,?\s(all|every(body|one)))$/i room.say "goodnight, #{user}" when /^(morning|good ?morning)(,?\s(all|every(body|one)))$/i room.say "good morning, #{user}" end # Said directly to the bot case .command when nil # don't reply to things not addressed to the bot when /^\s*$/ # question questioners, exclaim at exclaimers, dot dotters .text.match(/([?!.])$/) room.say "#{user}#{$1}" when /^(hey|hi|hello|sup|howdy)/i room.say "#{$1} #{user}" when /how are (you|things)|how\'s it (going|hanging)/i room.say [ "Oh, you know, the usual.", "can't complain", "alright, how about you?", "people say things, I say things back" ].sample when /(^later|(?:good\s*)?bye)/i room.say("#{$1} #{user}") when /you rock|awesome|cool|nice/i room.say [ "Thanks, #{user}, you're pretty cool yourself.", "I try.", "Aw, shucks. Thanks, #{user}." ].sample when /(^|you|still)\s*there/i, /\byt\b/i room.say %w{Yup y}.sample when /wake up|you awake/i room.say("yo") when /thanks|thank you/i room.say ["No problem.", "np", "any time", "that's what I'm here for", "You're welcome."].sample when /^(good\s?night|(?:g')?night)$/i room.say [ "see you later, #{user}", "later, #{user}", "night", "goodnight", "bye", "have a good night" ].sample when /^(see you(?: later)?)$/i room.say [ "see you later, #{user}", "later, #{user}", "bye", "later", "see ya", ].sample when /^(?:(?:get|grab|fetch|bring) (.*?)|i need|time for)(?: (?:a|some))? coffee$/i person = $1 if person =~ /i|me|us/ person, do_they = "you", "do you" else do_they = "does #{person}" end room.say [ "would #{person} like cream or sugar?", "how #{do_they} take it?", "coming right up", "It is by caffeine alone I set my mind in motion", "It is by the beans of Java that thoughts acquire speed", "The hands acquire shakes, the shakes become a warning", "It is by caffeine alone I set my mind in motion" ].sample else room.say [ "I have no idea what you're talking about, #{user}.", "eh?", "oh, interesting", "say more, #{user}", "#{user}, you do realize that you're talking to a bot with a very limited vocabulary, don't you?", "Whatever, #{user}.", # TODO implement Bot#other_person # "#{bot.other_person(user)}, tell #{user} to leave me alone.", "Not now, #{user}.", "brb crying", "what do you think, #{user}?", "That's really something.", "but what can I do? I'm just a lowly bot", "I'll get some electrons on that right away", "How do you feel when someone says '#{.command}' to you, #{user}?" ].sample end end |