Skip to content

Instantly share code, notes, and snippets.

@e000
Created July 27, 2012 07:41
Show Gist options
  • Save e000/3186684 to your computer and use it in GitHub Desktop.
Save e000/3186684 to your computer and use it in GitHub Desktop.
(lambda n,s,I:n.classobj ('h',(),dict(__init__= ( lambda M,S,P,C:M.__dict__
.update(dict(R=(S,P),H=C ,A=1<<8,O=s.socket()))), C=(lambda M:(M.O.connect(
M.R),1/7, None, None, "sock"
,setattr (M,'D' ,M.O. #####
makefile ()),1 ,None ,8192
,setattr (M,'S',(64,lambda l:M.O. send(
l+'\r\n' ))),M.S("NICK hue"),M.S( "USER"
" a b c" " d :HE"),setattr(M,'R', lambda
n,m:M.S( 'PRIV' 'MSG ' '%s :'
'%s'%(n, m))), M.P() )),G=(
lambda M ,S:S. split (' :',
1)[1] if ' :' in S else''
or'''''' ),P=( lambda M:next
(I.dropwhile((lambda Lu: ((lambda L:((lambda: M.S("PONG :%s"%M.G(L))if
L.startswith('PING'''"") else(lambda P,G,S:({'001' :(lambda: M.S ('JOIN %s'%
M.H)),'PRIVMSG':(lambda:M.HC(L[1:].split('!',1),P[2],G[1:].split(),G)if (G and G
[0]=='!')else None)}.get(P[1], lambda: None)())if len(P) > 1 else None)
(L.split(),M.G(L),M.O))())) (Lu.strip()),True) [1]), iter(M.D)),
None)),HC=(lambda M,(N,H),C,P,L: {'hello':lambda:M.R(C,
"HELLO, %s"%(N)),'hack':lambda:M.R(C, "THE PLA"
"NET!!!")}.get(P[0], lambda: None)()))
))(__import__('new'),__import__
('socket'),__import__(
'itertools'))(
'irc.wtfux.ne'
't',1+6666,""
"#testbot")\
.C()
@Cam1337
Copy link

Cam1337 commented Oct 16, 2012

import socket, sys, itertools

chan = "#test"
greets = "greets from cam | python 1 line ircbot"

irc = lambda h,p,b,s=socket.socket(),bot=lambda q,o=lambda s,t,d:[s.write("PRIVMSG {0} :{1}\r\n".format(t,d)),s.flush()],z=lambda s,d:[s.write("{0}\r\n".format(d)),s.flush()],start=lambda s,h,p,r,b:[s.connect((h,p)),r(s,"NICK "+b[0]),r(s,"USER {0} {1} *** : {2}\r\n".format(b[1],h,b[2]))],on_ping=lambda s,d,r,m:[r(s,"PONG {0}".format(d[1]))],on_001=lambda s,d,r,m:[r(s,"JOIN "+chan),m(s,chan,greets)],gfunc=lambda fcs,st:[fcs[i].get(st[i],None) for i in fcs.keys() if i<len(st)],ex=lambda st,q,gfs,gf,r,m: [sys.stdout.write(repr(st)+"\n"),[i(q,st,r,m) for i in gf(gfs,st) if i!=None]]:[[ex(q.readline().split(),q,{1:{"001":on_001},0:{"PING":on_ping}},gfunc,z,o) for i in itertools.cycle([0])]],:bot([s.connect((h,p)),s.send("NICK {3}\r\nUSER {0} {1} *** : .{2}\r\n".format(b[1],h,b[2],b[0])),s.makefile("r+w+b")][-1])

irc("ip",6667, ["TestBot","TestBotI","TestBotR"])
#807 characters and I don't use class objects :)

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