Closed danielbayerlein closed 11 years ago
jabber.yml
Gemfile
source 'https://rubygems.org' gem 'xmpp4r', '~> 0.5'
bot.rb
require 'rubygems' require 'xmpp4r' require 'xmpp4r/muc/helper/simplemucclient' require 'yaml' class Bot attr_accessor :config, :client, :muc def initialize(config) self.config = config self.client = Jabber::Client.new(config[:jid]) self.muc = Jabber::MUC::SimpleMUCClient.new(client) Jabber.debug = true if Jabber.logger = config[:debug] self end def connect client.connect client.auth(config[:password]) client.send(Jabber::Presence.new.set_type(:available)) self end def idle puts 'running' loop { sleep 1 } end config = YAML.load_file('../config/jabber.yml') config[:debug] = Logger.new(STDOUT) Bot.new(config).connect.idle
thanks alot I appriciate it ;)
jabber.yml
.Gemfile
bot.rb