Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # encoding: utf-8
- import platform
- import socket
- import sys
- reload(sys)
- sys.setdefaultencoding("utf8")
- ##config
- server = "ip"
- channel = "#canal"
- nick = "nick"
- user = "usuario"
- senduser = False
- sendnick = False
- sendpassword = False
- password = "Senha"
- irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- print "\nConnecting to: " + server + ":"
- irc.connect((server, 6667))
- def sendmsg(msg):
- irc.send("PRIVMSG " + channel + " :" + msg + "\n")
- try:
- while 1:
- text = irc.recv(2048)
- if len(text) > 0:
- print text
- else:
- continue
- if text.find("PING") != -1:
- irc.send("PONG " + text.split()[1] + "\n")
- if senduser == False:
- irc.send("USER " + user + " " + user + " " + user + " :" + user + "\n")
- senduser = True
- continue
- if senduser and sendnick == False:
- irc.send("NICK " + nick + "\n")
- sendnick = True
- continue
- if sendpassword == False:
- irc.send("NICKSERV IDENTIFY " + password + "\r\n")
- sendpassword = True
- continue
- if text.find("255 " + nick) != -1:
- global br
- irc.send("JOIN " + channel + "\n")
- ##Comandos
- if text.find("!oi") != -1:
- sendmsg("ola")
- except KeyboardInterrupt:
- sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement