Title / Description
Code require'socket' $t=TCPSocket.new('irc.freenode.net',6667) $x=[] Dir['*'].each do |f| File.readlines(f).each{|l| if l =~ /^(\[[^\]]+\]|\d\d:\d\d:\d\d) <[^>]+> (.+)$/ $x << $2.gsub(/^([^ ]+)[,:]\s+/, '') end} end def choose $x[rand $x.length] end $t.puts "USER optbot optbot optbot optbot" $t.puts "NICK optbot" $t.puts "JOIN #esoteric" $t.puts "PRIVMSG NickServ :identify aaaaaaaaaaaaaaaa" Thread.new do loop do $t.puts "TOPIC #esoteric :the entire backlog of #esoteric: http://tunes.org/~nef/logs/esoteric | #{choose}" sleep 21600 end end while l = $t.gets if l =~ /:([^!]+)[^ ]* PRIVMSG #esoteric :(.+)/ && l.downcase.include?('optbot') if $2.downcase.strip == 'optbot!' $t.puts "TOPIC #esoteric :the entire backlog of #esoteric: http://tunes.org/~nef/logs/esoteric | #{choose}" else $t.puts "PRIVMSG #esoteric :#{$1}: #{choose}" end end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code