Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import socket
- owner = 'MrPoxipol'
- serv = 'irc.freenode.org'
- port = 6667
- chan = '#poxipol_chan'
- nick = 'MrPoxipol1'
- prefix = '@'
- locked = False
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((serv, port))
- s.recv(4096)
- s.send('USER ja-abus abuse abuse :TAK!\r\n')
- s.send('NICK ' + nick + '\r\n')
- s.send('JOIN ' + chan + '\r\n')
- def getMsgNick(data, i):
- user = data[1:i]
- ni = user.find('!')
- return user[:ni]
- while 1:
- data = s.recv(4096)
- print (data)
- if data.find( 'PING' ) != -1:
- s.send('PONG ' + data.split() [1] + '\r\n')
- index = data.find('Witaj, ' + nick)
- if index != -1:
- s.send('PRIVMSG ' + chan + ' :' + 'Czesc ' + getMsgNick(data, index) + '!\r\n')
- index = data.find(prefix + 'won')
- if index != -1:
- if getMsgNick(data, index) == owner:
- s.send('QUIT :Pa, pa')
- break;
- else:
- s.send('PRIVMSG ' + chan + ' :' + '<Nie masz praw>\r\n')
- index = data.find(prefix + 'google')
- if index != -1:
- str = data[index+len('google')+2:]
- str = str.rstrip()
- send = False;
- if len(str) > 1:
- if str[1] == ' ':
- str = str.lstrip()
- send = True
- if send:
- s.send('PRIVMSG ' + chan + ' :' + 'http://google.pl/search?q=' + str.replace(' ', '+') + '\r\n')
- if data.find(prefix + 'help') != -1:
- s.send('PRIVMSG ' + chan + ' :' + 'Dostępne komendy: help, google, won*\r\n')
- s.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement