Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. # -*- coding: cp1252 -*-
  2.     #!/usr/bin/python
  3.  
  4.    import socket
  5.  
  6.  
  7.     def botirc():
  8.  
  9.          print>>> Configurazione Bot >>>
  10.  
  11.          print"
  12.  
  13.         nome = raw_input (“Nome bot >>> “)
  14.  
  15.         server = raw_input (“Server >>> “)
  16.  
  17.         canale = raw_input (“Canale >>> “)
  18.  
  19.         porta = 6667  
  20.  
  21.         sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
  22.  
  23.         sock.connect((server, porta))
  24.  
  25.         sock.send (“NICK %s\r\n” % (nome))  
  26.  
  27.         sock.send(“USER 666 %s bla :%s\r\n” % (server,nome))  
  28.  
  29.         sock.send (“JOIN %s\r\n” % (canale))    
  30.  
  31.         while 1:  
  32.  
  33.                 ricev = sock.recv(1024)
  34.  
  35.                 print ricev
  36.  
  37.                 if ricev.startswith (‘PING :’):
  38.  
  39.                    sock.send(‘PONG :’ + ricev.split(‘ ‘)[1] + ‘\r\n’)
  40.  
  41.    botirc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement