Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import re
- import hashlib
- import time
- server = "irc.efnet.org"
- channel = "#kanava1"
- channel2 = "#kanava2"
- botnick = "Bot"
- def ping():
- ircsock.send("PONG :Pong\n")
- def sendmsg(chan, msg):
- ircsock.send("PRIVMSG "+ chan +" :"+ msg +"\n")
- def joinchan(chan):
- ircsock.send("JOIN "+ chan +"\n")
- def hello(newnick):
- ircsock.send("PRIVMSG "+ channel +" :HELLO!\n")
- def response(hash):
- ircsock.send("PRIVMSG "+ channel +" :!perm8-result "+ hash +"\n")
- def version():
- ircsock.send("VERSION :Bot1.0\n")
- ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- ircsock.connect((server, 6667))
- ircsock.send ("USER Bot 2 3 " + botnick + "\n")
- ircsock.send ("NICK "+ botnick + "\n")
- while 1:
- ircmsg = ircsock.recv(2048)
- ircmsg = ircmsg.strip('\n\r')
- print(ircmsg)
- if ircmsg.find(":Hello "+ botnick) != -1:
- hello()
- if ircmsg.find("PING :") != -1:
- ping()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement