Class: SpsBot
- Inherits:
-
SPSChat
- Object
- SPSChat
- SpsBot
- Defined in:
- lib/sps_bot.rb
Instance Method Summary collapse
-
#initialize(host: '127.0.0.1', port: '8080', userid: 'bot', room: '', config: nil, typing_mode: false, drb: {host: 'bot.home', port: '60600'}) ⇒ SpsBot
constructor
A new instance of SpsBot.
- #onincoming(sender, msg, typing_mode = false) ⇒ Object
Constructor Details
#initialize(host: '127.0.0.1', port: '8080', userid: 'bot', room: '', config: nil, typing_mode: false, drb: {host: 'bot.home', port: '60600'}) ⇒ SpsBot
Returns a new instance of SpsBot.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sps_bot.rb', line 11 def initialize(host: '127.0.0.1', port: '8080', userid: 'bot', room: '', config: nil, typing_mode: false, drb: {host: 'bot.home', port: '60600'}) @bot = BotBaseDRbClient.new host: drb[:host], port: drb[:port] @typing_mode = typing_mode super(host: host, port: port, userid: userid, room: room, interactive: false) end |
Instance Method Details
#onincoming(sender, msg, typing_mode = false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/sps_bot.rb', line 22 def onincoming(sender, msg, typing_mode=false) if not typing_mode then response = @bot.received sender, msg, mode: :chat self.send response unless response.empty? end end |