2012-12-06 32 views
1

我们有一个私人聊天服务器在我们拥有的服务器上运行。例如:company.server.com。我们通过端口5223与我们的聊天客户端连接。如何使用jabber-bot连接到聊天服务器

如何让Jabber-bot连接到此聊天?如果我想连接到某个特定的房间,该怎么办?

下面是我有,但它似乎只是挂起,什么都不做。我相信应该有一个属性,我应该提供我连接到的服务器的名称,但我无法在任何地方找到该属性。

require 'rubygems' 
require './jabber/bot' 

# Create a public Jabber::Bot 
config = { 
    :jabber_id => '[email protected]', 
    :password => 'mypassword', 
    :master => '[email protected]', 
    :presence => :chat, 
} 

bot = Jabber::Bot.new(config) 

# Give your bot a private command, 'rand' 
bot.add_command(
    :syntax  => 'rand', 
    :description => 'Produce a random number from 0 to 10', 
    :regex  => /^rand$/ 
) { rand(10).to_s } 


# Bring your new bot to life 
bot.connect 

回答