Skip to content

Instantly share code, notes, and snippets.

@june29
Created September 8, 2012 14:01
Show Gist options
  • Save june29/3675184 to your computer and use it in GitHub Desktop.
Save june29/3675184 to your computer and use it in GitHub Desktop.
# -*- 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