Guest User

Untitled

a guest
May 18th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. require 'socket'
  2.  
  3.  
  4. ################
  5. # Variables declaration: Settings
  6. ################
  7. Server = "irc.quakenet.org"
  8. Port = "6667"
  9.  
  10. Nick = "EEDbot"
  11. User = "EEDbot claneed.free.fr irc.quakenet.org :EEDbot"
  12.  
  13. # If the server is not irc.quakenet.org then set Authed to FALSE and ignore Qauth & Qpass
  14. Authed = TRUE
  15. # N.B. make sure to clear the Qpass variable before sending on this code!!!
  16. Qauth = "EEDbot"
  17. Qpass = "LFysvrYL9k"
  18.  
  19. # The channel in which the bot functions
  20. Chan = "#test555"
  21.  
  22. def main
  23. $Done = FALSE
  24. $Initialized = FALSE
  25.  
  26. while (!$Done)
  27. #IRC protocol limits messages to 512 characters, ie 4096 bytes
  28. data = $conn.recv(4096).strip
  29.  
  30.  
  31. if (!$Initialized) then
  32. $conn.send("NICK #{Nick}",0)
  33. $conn.send("USER #{User}",0)
  34. puts ">>> Sending Nick and User info"
  35. $Initialized = TRUE
  36. end
  37.  
  38.  
  39. data.split("\n").each do |line|
  40. case line
  41. when /^PING :(.+)$/i
  42. puts "[Server Ping :#{$1}]"
  43. $conn.send("PONG #{$1}",0)a
  44. else
  45. puts line
  46. end
  47. end
  48.  
  49.  
  50. puts "--- initialized = #{$Initialized}" #temporarily print variablea
  51. STDOUT.flush
  52. end
  53. end
  54.  
  55.  
  56. $conn = TCPSocket.new(Server,Port)
  57. main
Add Comment
Please, Sign In to add comment