RubyのCinchを使ってIRCボットを作る
2012-09-04 - ⧖ 1.0 minRubyで簡単にIRCボットつくれないかなーってことでたどり着いたのが Cinch 。
10秒間隔でNOTICEメッセージをしゃべる例
require 'cinch'
class HelloPlugin
include Cinch ::Plugin
timer 10 , method : :say_hello
def say_hello
Channel ( "#pgmagick" ). notice "hello world"
end
end
bot = Cinch ::Bot . new do
configure do |c |
c . nick = "cinch_timer"
c . server = "irc.freenode.org"
c . channels = [ "#pgmagick" ]
c . plugins . plugins = [ HelloPlugin ]
end
end
bot . start
楽ちんですね。