-
-
Save anonymous/448807d9db416095ffbd002e03d4553c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment