irc-bot/src/irc.cr
2022-12-31 00:26:30 +03:00

23 lines
399 B
Crystal

require "socket"
SERVER = "iiiypuk.me"
PORT = 6667
NICK = "irc-cr"
USER = "Axel"
puts "Running..."
irc = TCPSocket.new(SERVER, PORT)
irc << "USER #{NICK} . . :This is a bot!\n"
irc << "NICK #{NICK}\r\n"
irc << "PRIVMSG #{USER} :!time\r\n"
while response = irc.gets
if response.to_s.includes?("PING")
irc << "PONG #{response.to_s.split[1]}\r\n"
end
end
irc << "QUIT\r\n"
irc.close