Class ::Bot::RemoteObject
In: lib/rbot/core/remote.rb
Parent: Object
User HTTPResponse BasicUserMessage Bot\n[lib/rbot/core/remote.rb\nlib/rbot/core/utils/extends.rb\nlib/rbot/core/utils/filters.rb\nlib/rbot/core/utils/wordlist.rb] HttpUtil lib/rbot/core/userdata.rb lib/rbot/core/utils/httputil.rb lib/rbot/core/utils/extends.rb lib/rbot/core/remote.rb lib/rbot/core/utils/httputil.rb ParseTime Utils (null) dot/m_15_0.png

The Irc::Bot::RemoteObject class represents and object that will take care of interfacing with remote clients

Example client session:

  require 'drb'
  rbot = DRbObject.new_with_uri('druby://localhost:7268')
  id = rbot.delegate(nil, 'remote login someuser somepass')[:return]
  rbot.delegate(id, 'some secret command')

Of course, the remote login is only neede for commands which may not be available to everyone

Methods

delegate   new  

Included Modules

DRbUndumped

Public Class methods

Initialization is simple

[Source]

     # File lib/rbot/core/remote.rb, line 213
213:       def initialize(bot)
214:         @bot = bot
215:       end

Public Instance methods

The delegate method. This is the main method used by remote clients to send commands to the bot. Most of the time, the method will be called with only two parameters (session id and a String), but we allow more parameters for future expansions.

The session_id can be nil, meaning that the remote client wants to work as an anoynomus botuser.

[Source]

     # File lib/rbot/core/remote.rb, line 225
225:       def delegate(session_id, *pars)
226:         warn "Ignoring extra parameters" if pars.length > 1
227:         cmd = pars.first
228:         client = @bot.auth.remote_user(session_id)
229:         raise "No such session id #{session_id}" unless client
230:         debug "Trying to dispatch command #{cmd.inspect} from #{client.inspect} authorized by #{session_id.inspect}"
231:         m = RemoteMessage.new(@bot, client, cmd)
232:         @bot.remote_dispatcher.handle(m)
233:       end

[Validate]