Skip to content

Instantly share code, notes, and snippets.

@0x0dea

0x0dea/bot.rb Secret

Created June 11, 2015 19:48
Show Gist options
  • Save 0x0dea/9cd62f3a58cd52de87a4 to your computer and use it in GitHub Desktop.
Save 0x0dea/9cd62f3a58cd52de87a4 to your computer and use it in GitHub Desktop.
require 'socket'
s = TCPSocket.new 'irc.freenode.net', 6667
s.puts "NICK foo"
s.puts "USER foo 0 * :foo"
s.puts "JOIN #ruby"
loop do
case msg = s.gets
when /PING (\S+)/
s.puts "PONG #$1"
when /:>> (.+)/
s.puts "PRIVMSG #ruby :#{eval $1}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment