Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import socket
  2. import re
  3. import hashlib
  4. import time
  5.  
  6. server = "irc.efnet.org"
  7. channel = "#kanava1"
  8. channel2 = "#kanava2"
  9. botnick = "Bot"
  10.  
  11. def ping():
  12. ircsock.send("PONG :Pong\n")
  13.  
  14. def sendmsg(chan, msg):
  15. ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
  16.  
  17. def joinchan(chan):
  18. ircsock.send("JOIN "+ chan +"\n")
  19.  
  20. def hello(newnick):
  21. ircsock.send("PRIVMSG "+ channel +" :HELLO!\n")
  22.  
  23. def response(hash):
  24. ircsock.send("PRIVMSG "+ channel +" :!perm8-result "+ hash +"\n")
  25.  
  26. def version():
  27. ircsock.send("VERSION :Bot1.0\n")
  28.  
  29.  
  30.  
  31. ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  32. ircsock.connect((server, 6667))
  33. ircsock.send ("USER Bot 2 3 " + botnick + "\n")
  34. ircsock.send ("NICK "+ botnick + "\n")
  35.  
  36. while 1:
  37. ircmsg = ircsock.recv(2048)
  38. ircmsg = ircmsg.strip('\n\r')
  39. print(ircmsg)
  40.  
  41. if ircmsg.find(":Hello "+ botnick) != -1:
  42. hello()
  43. if ircmsg.find("PING :") != -1:
  44. ping()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement