12-18-2009, 08:02 PM
(12-18-2009, 05:15 PM)Master of The Universe Wrote: Awsome, I really don't have better words..... Just AWSOME!
That's a really nice update, and I hope to see the next soon, can't wait actually!!!
I see you are alreay using it in the HF IRC channel, but I don't get the "!hunt" thing!
edit:
What if my bot uses an list of strings for spaming, so it posts different messages, that will not kill him, right?
nah, lol. i may add support for that in the future by logging more lines and dividing it by the number of unique messages to see which are spam which are not ect, not sure. but atm the script is completely butchered and i plan on taking a break from it. its giving ALOT of trouble lol
heres what i have, doesnt really work but meh cant hurt showing lol: http://pastebin.com/m47c5dfc
Code:
import xchat, threading
__module_name__ = "Bot Kill"
__module_version__ = '1.0'
__module_description__ = "Kills multiple spammers using same message"
lastfour = []
bantexts = []
times = []
minutes = 3
"""
PROBLEMS:
ONE TIMER WORKS WELL, WHEN YOU ADD A SECOND TIMER, STOPS FIRST, DOUBLE THREADS SECOND
MENU IS STILL fudged
"""
def addsec():
timedata = threading.local()
if times[len(times)-1]['time'] == 0:
global b
b = len(times)-1
timedata.pos = b
try:
times[timedata.pos]['time'] += 1
if not times[timedata.pos]['time'] == minutes*60-2:
t = threading.Timer(1.0,addsec)
t.start()
except:
pass
def SpamCheck(word, word_eol, userdata):
num = 0
cont = True
name, msg = word[0], word[1]
if bantexts:
if msg in bantexts:
xchat.command('KILL '+name+' SpamCheck Script')
cont = False
lastfour.append([name,msg])
if cont:
if len(lastfour) == 4:
while num <= len(lastfour)-1:
if num == 3:
if not name == lastfour[2][0]:
bantexts.append(msg)
times.append({'time':0})
addsec()
xchat.command('echo Adding KOS for "'+msg+'", will remove in '+str(minutes)+' minutes.')
xchat.command('KILL '+name+' SpamCheck Script')
xchat.hook_timer(minutes*60*1000,time)
num += 1
if msg == lastfour[num][1]:
num += 1
else:
break
del lastfour[0]
def time(userdata):
global bantexts
xchat.command('echo Removed KOS for "'+bantexts[0]+'".')
del bantexts[0]
del times[0]
return xchat.EAT_NONE
def Menu(word, word_eol, userdata):
append = False
remove = False
global minutes
try:
if word[1] == "-a" | word[1] == "a":
append = True
if word[1] == "-r" | word[1] == "r":
remove = True
except:
pass
if not append|remove:
xchat.command('echo --------Kill List--------')
if len(bantexts) == 0:
xchat.command('echo *No kill texts currently.')
else:
for ban in bantexts:
xchat.command('echo *Text: "'+ban+'".')
xchat.command('echo **Time left: '+str(minutes*60-times[bantexts.index(ban)]['time'])+' seconds.')
if not bantexts.index(ban) == len(bantexts)-1:
xchat.command('echo --------')
xchat.command('echo -------------------------')
if append:
total = len(word)-1
msg = []
if word[len(word)-1].isdigit():
time = word[len(word)-1]
total = len(word)-2
for i in range(2,total):
msg.append(word[i])
btext = ' '.join(msg)
bantexts.append(btext)
times.append({'time':0})
addsec()
if remove:
msg = []
for i in range(2,len(word)-1):
msg.append(word[i])
btext = ' '.join(msg)
num = 0
while num <= len(bantexts)-1:
if bantexts[num][1] == btext:
xchat.command('echo Removed KOS for "'+bantexts[0]+'".')
del bantexts[num]
del timer[num]
break
num = num + 1
xchat.hook_command('sc', Menu)
xchat.hook_print('Channel Message', SpamCheck)
xchat.hook_print('Channel Action Hilight', SpamCheck)
xchat.hook_print('Channel Msg Hilight', SpamCheck)