Skip to content

Instantly share code, notes, and snippets.

@Aubizzy
Forked from anonymous/-
Created March 1, 2018 14:28
Show Gist options
  • Save Aubizzy/2ba73fbc86f019cac744cef88bc6d190 to your computer and use it in GitHub Desktop.
Save Aubizzy/2ba73fbc86f019cac744cef88bc6d190 to your computer and use it in GitHub Desktop.
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
@Aubizzy
Copy link
Author

Aubizzy commented Mar 1, 2018

following

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment