From 3a5966e13dcbc20f1759726f7912cdaf2c2fe7e7 Mon Sep 17 00:00:00 2001 From: Juhani Haverinen Date: Thu, 18 Jul 2013 16:31:25 +0300 Subject: [PATCH] Made it possible to automaticaly execute commands on startup using startcmd.txt --- .gitignore | 1 + botcmd.py | 2 ++ botcmd.pyc | Bin 5683 -> 5781 bytes ircbot.py | 8 +++++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index a737147..af481ac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ msgs.txt trusted.txt +startcmd.txt *.pyc diff --git a/botcmd.py b/botcmd.py index e1c1d60..e28eaa5 100644 --- a/botcmd.py +++ b/botcmd.py @@ -97,6 +97,8 @@ def parse((line,irc)): msglock.release() elif line[3]==':#help': irc.send('PRIVMSG %s :%s'%(chan,help(' '.join(line[4:])))) + elif line[3]==':#esoteric' and chan=='#esoteric': + irc.send('PRIVMSG %s :Nothing here'%chan) elif line[3][1:] in ('oonbotti:', 'oonbotti', 'oonbotti,', 'oonbotti2', 'oonbotti2:', 'oonbotti2,'): irc.send('PRIVMSG %s :%s: %s'%(chan,nick,doctor.respond(' '.join(line[4:])))) elif line[1]=='NOTICE' and line[0].split('!')[0]==':NickServ' and line[4]=='ACC': diff --git a/botcmd.pyc b/botcmd.pyc index 41ea9b62f134dc68072536770b6c2b5f7bbd89b8..88448e2768bf0ab5bca626990fdc7517d10aff62 100644 GIT binary patch delta 646 zcmYjOO>5Lp6utN5C7G9L$7(bE0BfRU(sb;!BB)qI!HrX>qqZQp5QRyw(}9*I5rodd zkA*+rBG{!Hmx5+j(T(87r3(eAh#R+ppf0`1IMdnOyz|a^=boFJ&OND_+OJ{j?}e`~ z&5ww?^aXEBA+#k#+t5J>BuoZ6v_&7&H8F}vp;&MOfK}fBfJTc8#6>PibT>}IU_QB* ztk7HWX?!fB(84m5@Bj{Dg};Z;PG4w;5ohRwtm1R}E!*Olq^5of>$IaU3rErq{X7HD z$U$OcAT@569oZ4E&dF@(NEmyBfLnF)&1vSB%?JDZ#329Oyw7~IaIR6;v#|<1)>J;$ zXN_%wBfWFi+ZlM<*Gq7M1!x-(u}4?u(VN2T#k#)XVeeO2FhgK%fDq3>XCd z09j-_`yZ39yvm;JCF4%X!Ms!VZj`0fT)IcGs^L3&rpATRX;+;YIi3^!NOOdi??rk4 zY~|msc;j zmDpWuY$j{1jXUmI7=`KSp_{@u$%^X zSq}MqC?RB2@Mkp0vX-U=)`gtb*|@K$Kyoevuo%$+V15(ng8Au&J)%XYir>CedJ!X3 z<)gSuZ#>IB6iTZJLC@3_t1DDfr-cY;Qfz3BxYE|lx>91WC6;$Xi9^pZ0`6GUrw<7} zqaXco>py?c4+T%VrUoq4Y3>ruIRrB?$ZC)mvqt6+y}F{NrRKuuxVUf)%m2M|3L2&r zY6=H>1PuSelo1Y9_`l?$PbN2JUBWsdtra>q;sN66TuffD*`w)x;`Cxnc1EPNRVqp$ zcO*P3dpnIrCEid=3KVs@MZ6pR$Ee^Q#JF8{-=SUht}tyv9KUctU+t^*a>p&=o^ASq S98c_onMT8_Gs9yf4et-t@o?V& diff --git a/ircbot.py b/ircbot.py index 8c70f18..38812c9 100644 --- a/ircbot.py +++ b/ircbot.py @@ -54,7 +54,13 @@ class Connhandler(threading.Thread): self.send('NICK %s'%self.nick) self.send('USER %s a a :%s'%(self.nick,self.name)) - self.send('JOIN %s'%(self.chan)) + f=open('startcmd.txt','r') + for i in f: + if i[-1]=='\n': i=i[:-1] + self.send(i) + f.close() + for i in self.chan.split(' '): + self.send('JOIN %s'%(i)) buf='' while True: