RubyのCinchを使ってIRCボットを作る
Posted on Tue, 04 Sep 2012 01:58:14 +0900
Rubyで簡単に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
楽ちんですね。