a
Ruby
code posted
created at 08 Jan 18:37
Edit
|
Back
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 32 33 34 35 36 37 38 39 40 41 |
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 |
939 Bytes in 3 ms with coderay