File: echo_bot.rb

package info (click to toggle)
ruby-net-irc 0.0.9-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 408 kB
  • sloc: ruby: 7,268; makefile: 3
file content (31 lines) | stat: -rwxr-xr-x 440 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env ruby
# vim:encoding=UTF-8:

$LOAD_PATH << "lib"
$LOAD_PATH << "../lib"

require "rubygems"
require "net/irc"

require "pp"

class EchoBot < Net::IRC::Client
	def initialize(*args)
		super
	end

  def on_rpl_welcome(m)
    post JOIN, "#bot_test"
  end

  def on_privmsg(m)
    post NOTICE, m[0], m[1]
  end
end

EchoBot.new("foobar", "6667", {
	:nick => "foobartest",
	:user => "foobartest",
	:real => "foobartest",
}).start