Created
September 8, 2012 14:01
-
-
Save june29/3675184 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
require_relative "passer" | |
require "eventmachine" | |
class SeeyouPasser < Passer | |
def initialize(name) | |
super(:stream, name) | |
@messages = ["またお会いしましょう!", "See you again!"] | |
@count = 0 | |
end | |
def trigger | |
data = { | |
:channel => "channel", :nick => "RubyKaigi", | |
:message => @messages[@count % 2], | |
:usec => Time.now.usec | |
} | |
p ["Irc Example", data] | |
pass(data) | |
@count += 1 | |
end | |
end | |
EventMachine::run { | |
seeyou2 = SeeyouPasser.new("irc-kaigi1-m17n") | |
EventMachine::add_periodic_timer(1) { | |
seeyou2.trigger | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment