Guest User

Untitled

a guest
Mar 11th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. import socket,time
  2. network = 'irc.freenode.net'
  3. port = 6667
  4. channels = ['#digibytecoin'] #Add as many as you want
  5. nick = 'clickboom'
  6. identify = False
  7. password = 'superAwesomePassword'
  8. irc = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
  9. print "Connecting to "+network+" ..."
  10. irc.connect ((network, port))
  11. print "Changing nick to "+nick+"..."
  12. irc.send ('NICK '+nick+'\r\n')
  13. if identify == True:
  14. print "Verifying password..."
  15. irc.send("PASS %s\n" % (password))
  16. print "Setting login data..."
  17. irc.send ('USER '+nick+' '+nick+' '+nick+' :'+nick+' IRC\r\n')
  18. time.sleep(1)
  19. for channel in channels:
  20. print "Joining "+channel+"..."
  21. irc.send ('JOIN '+channel+'\r\n')
  22. irc.send ('PRIVMSG '+channel+' :'+nick+' Started! Type ^help for more, if you mind me testing a bot in this channel, PM boomclick.\n')
  23. time.sleep(1)
  24. while True:
  25. data = irc.recv(4096)
  26. if data.find('PING') != -1:
  27. irc.send('PONG '+data.split()[1]+'\r\n')
  28. try:
  29. user = data.split("!",1)[0].replace(":","",1)
  30. vhost = data.split(" ",1)[0].split("!",1)[1]
  31. dType = data.split(" ",1)[1].split(" ",1)[0]
  32. chan = data.split(" ",1)[1].split(" ",1)[1].split(" ",1)[0]
  33. msg = data.split(" ",1)[1].split(" ",1)[1].split(" ",1)[1].replace(":","",1).replace("\n","",1).replace("\r","",1)
  34. if msg == '^help':
  35. irc.send ('PRIVMSG '+chan+' :if anyone minds me testing a bot in this channel, please tell me\r\n')
  36. if msg == '^beg':
  37. irc.send ('PRIVMSG '+chan+' :.beg\r\n')
  38. elif msg == '^beg':
  39. irc.send ( 'PRIVMSG '+chan+' :.beg')
  40. print user+" ("+vhost+") "+dType+" to "+chan+": "+msg
  41. except:
  42. pass
Add Comment
Please, Sign In to add comment