Advertisement
Guest User

Untitled

a guest
Dec 17th, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.31 KB | None | 0 0
  1. __author__ = 'Wojto'
  2. import socket
  3. import random
  4. host = "irc.freenode.net"
  5. chan = "#sram"
  6. bnick = "Guwnobot"
  7. port = 6667
  8.  
  9. ircsock = socket.socket()
  10. ircsock. connect((host, port))
  11. #guwner
  12.  
  13. podmiot = open('podmiot.txt', 'r')
  14. okolicznik = open('okolicznik.txt', 'r')
  15. orzeczenie = open('orzeczenie.txt', 'r')
  16. dopelnienie = open('dopelnienie.txt', 'r')
  17. przydawka = open('przydawka.txt', 'r')
  18. linep = random.choice(open('podmiot.txt').readlines())
  19. lineok = random.choice(open('okolicznik.txt').readlines())
  20. lineorz = random.choice(open('orzeczenie.txt').readlines())
  21. linedop = random.choice(open('dopelnienie.txt').readlines())
  22. lineprz = random.choice(open('przydawka.txt').readlines())
  23.  
  24.  
  25.  
  26.  
  27. handle = ircsock.makefile(mode='rw', buffering=8, encoding='utf-8', newline='\r\n')
  28.  
  29. print('NICK', bnick, file=handle)
  30. print('USER', bnick, bnick, bnick, ':'+bnick, file=handle)
  31. print('JOIN', chan, file=handle)
  32. for line in handle:
  33.     line = line.strip()
  34.     print(line)
  35.  
  36.     if 'PING' in line:
  37.         print("PONG :" + line.split(':')[1], file=handle)
  38.     if 'Witam' in line:
  39.         print('PRIVMSG', chan, 'Witam guwno jebane', file=handle)
  40.     if 'Zguwnij' in line:
  41.         print('PRIVMSG', chan, linep.rstrip()+ lineok.rstrip()+ lineorz.rstrip()+ linedop.rstrip()+ lineok.rstrip()+ lineprz.rstrip(), file=handle)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement