uhuC
[Ruby] Fantasy::IRC Client/Bot gem - Druckversion

+- uhuC (https://uhuc.de)
+-- Forum: uhuc Classic (https://uhuc.de/forum-43.html)
+--- Forum: Kleinere Projekte (https://uhuc.de/forum-30.html)
+--- Thema: [Ruby] Fantasy::IRC Client/Bot gem (/thread-294.html)



[Ruby] Fantasy::IRC Client/Bot gem - v2px - 26.01.2013

Fantasy::IRC

Github: http://v2px.github.com/fantasy-irc/
Rubygems: https://rubygems.org/gems/fantasy-irc
Supportchannel: #fantasy @ freenode

Beschreibung
fantasy-irc ist ein Ruby Gem zum erstellen von einfachen, event-gesteuerten IRC bots (oder clients!).
Es unterstuetzt plugins (API neu und in Arbeit) und hat ein paar (wie ich finde) ganz nette Features.

Ein einfacher Beispiel-Bot, der User beim joinen gruesst, kann beispielsweise so aussehen:

Code:
#!/usr/bin/env ruby
require 'fantasy-irc'

bot = Fantasy::IRC.new

connected = Proc.new do
    bot.login :nickname => "example", :username => "example", :realname => "GECOS field"
end
bot.events.by_name('connected').register &connected

loggedin = Proc.new do
    %w{#lobby}.each do |r|
        bot.rooms.new(r).join
    end
end
bot.events.by_name('loggedin').register &loggedin

user_joined = Proc.new do |room, user|
    room.say("Hey, #{user.name}!")
end
bot.events.by_name('user_joined').register &user_joined

bot.connect :server => "irc.example.com", :ssl => true, :port => 6697
bot.run

Vielleicht hat ja jemand Interesse daran. Smile

NeuNeuNeu!: Plugin support.


RE: [Ruby] Fantasy::IRC Client/Bot gem - v2px - 28.01.2013

Hier ist noch ein Blogeintrag dazu: http://blog.v2px.de/2013/01/ruby-fantasy-irc-gem/ Blush