PasteSite.Com

Recent Pastes

Sign Up!

PasteSite is open to the public, but with limited features. Register to be able to modify access rights, track your pastes and more...

Change the theme

If you prefer reading light text on a dark background to dark text on a light background, then you might want to try the dark theme.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
######################### index.py #########################
import socket
import string
import array
import handle
 
HOST = 'irc.zymic.com'
PORT = 6667
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((HOST, PORT))
s.send("NICK Pythot\r\n")
s.send("USER Pythot Pythot Pythot :Pythot\r\n")
s.send("JOIN #test\r\n")
while True:
    data = string.strip(s.recv(1024), "" + chr(10) + chr(13))
    if len(data) == 0:
        break #eof
    print "" + data
    handleCondition(data)
 
######################### handle.py ########################
def handleCondition(data):
    ex = string.split(data, " ")
    if ex[0] == 'PING':
        s.send("PONG " + ex[1] + "\r\n")
        print "PONG " + ex[1] + ""
    elif ex[1] == 'PRIVMSG':
        print "Command"
        import functions
        functions.parseCmd(s, ex[3], ex[2])
 
###################### functions.py ########################
def parseCmd(sock, cmd, chan):
    if cmd == ':!test':
        sock.send("PRIVMSG " + chan + " Success!\r\n")
        print "Success"

Reply to This Paste

(leave blank to make this paste permanent)
(if set as private)