Advertisement
TheChosenCheese

IRC Bot Not working & Question

Apr 9th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.17 KB | None | 0 0
  1. #Did print to check if imports are the problem, but output is good. Printing an empty line when all output is done and not connection.
  2. print ("working")
  3. import sys
  4. print ("sys")
  5. import socket
  6. print ("socket")
  7. import string
  8. print ("string")
  9. import time
  10. print ("time")
  11. from time import gmtime, strftime, sleep
  12. print ("from time")
  13. import math
  14. print ("math")
  15. import re
  16. print ("re")
  17. from string import ascii_letters
  18. print ("ascii")
  19. from sys import argv
  20. print ("argv")
  21. def main():
  22.     print ("working")
  23.     operators = ["FreeProGamer"]
  24.     server = "irc.openredstone.org"
  25.     channel = "#openredstone"
  26.     botnick = "FPGBot"
  27.     readbuffer = ""
  28.    
  29.     irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket
  30.     print("connecting to: "+server)
  31.     irc.connect((server, 6667)) #connects to the server
  32.     irc.send("PASS password\r\n")
  33.     irc.send("USER "+ botnick +" "+ botnick +" "+ botnick + " :FPGBot\n") #user authentication
  34.     irc.send("NICK "+ botnick +"\n")                            #sets nick
  35.     sleep(5)
  36.     irc.send("JOIN " + channel + "\r\n")        #join the chan
  37.     irc.send("PRIVMSG OREBuild :/msg " + operators[0] + " Hello!\r\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement