Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket,time
- network = 'irc.freenode.net'
- port = 6667
- channels = ['#digibytecoin'] #Add as many as you want
- nick = 'clickboom'
- identify = False
- password = 'superAwesomePassword'
- irc = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
- print "Connecting to "+network+" ..."
- irc.connect ((network, port))
- print "Changing nick to "+nick+"..."
- irc.send ('NICK '+nick+'\r\n')
- if identify == True:
- print "Verifying password..."
- irc.send("PASS %s\n" % (password))
- print "Setting login data..."
- irc.send ('USER '+nick+' '+nick+' '+nick+' :'+nick+' IRC\r\n')
- time.sleep(1)
- for channel in channels:
- print "Joining "+channel+"..."
- irc.send ('JOIN '+channel+'\r\n')
- irc.send ('PRIVMSG '+channel+' :'+nick+' Started! Type ^help for more, if you mind me testing a bot in this channel, PM boomclick.\n')
- time.sleep(1)
- while True:
- data = irc.recv(4096)
- if data.find('PING') != -1:
- irc.send('PONG '+data.split()[1]+'\r\n')
- try:
- user = data.split("!",1)[0].replace(":","",1)
- vhost = data.split(" ",1)[0].split("!",1)[1]
- dType = data.split(" ",1)[1].split(" ",1)[0]
- chan = data.split(" ",1)[1].split(" ",1)[1].split(" ",1)[0]
- msg = data.split(" ",1)[1].split(" ",1)[1].split(" ",1)[1].replace(":","",1).replace("\n","",1).replace("\r","",1)
- if msg == '^help':
- irc.send ('PRIVMSG '+chan+' :if anyone minds me testing a bot in this channel, please tell me\r\n')
- if msg == '^beg':
- irc.send ('PRIVMSG '+chan+' :.beg\r\n')
- elif msg == '^beg':
- irc.send ( 'PRIVMSG '+chan+' :.beg')
- print user+" ("+vhost+") "+dType+" to "+chan+": "+msg
- except:
- pass
Add Comment
Please, Sign In to add comment