25 lines
483 B
Crystal
25 lines
483 B
Crystal
require "socket"
|
|
|
|
puts "Connecting..."
|
|
irc = TCPSocket.new("iiiypuk.me", 6667)
|
|
|
|
irc << "USER crystal localhost localhost :This is a bot!\n"
|
|
irc << "NICK crystal\r\n"
|
|
irc << "JOIN #admin\r\n"
|
|
irc << "PRIVMSG #admin :!time\r\n"
|
|
|
|
while true
|
|
response = irc.gets
|
|
puts response
|
|
|
|
if response.to_s.includes?("PING")
|
|
irc << "PONG #{response.to_s.split[1]}\r\n"
|
|
end
|
|
|
|
if response.to_s.includes?("!time")
|
|
irc << "PRIVMSG #admin :#{Time.local.to_unix}\r\n"
|
|
end
|
|
end
|
|
|
|
irc.close
|