Sha256: b59163e26a05921db560c3716f4f42304a9d6995a6b74edd6a734073b3997338
Contents?: true
Size: 689 Bytes
Versions: 1
Compression:
Stored size: 689 Bytes
Contents
#!/usr/bin/env ruby require File.join(File.dirname(__FILE__), '..', 'lib', 'on_irc') bot = IRC.new do nick 'on_irc' ident 'on_irc' realname 'on_irc Ruby IRC library' server :eighthbit do address 'irc.eighthbit.net' end end bot[:eighthbit].on '001' do join '#bots' end bot.on :privmsg do case params[1] when '!ping' msg(params[0], prefix.split('!').first + ': pong') when /^!echo (.*)/ msg(params[0], prefix.split('!').first + ': ' + $1) when /^!join (.*)/ join $1 end end bot.on :ping do pong params[0] end bot.on :all do p = "(#{prefix}) " unless prefix.empty? puts "#{server.name}: #{p}#{command} #{params.inspect}" end bot.connect
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
on_irc-2.0.1 | examples/bot.rb |