home
·
contact
·
privacy
projects
/
plomlombot-irc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
30c070d
)
Instead of removing names of present users, malkovich them.
author
Christian Heller
<c.heller@plomlompom.de>
Thu, 4 Feb 2016 07:53:22 +0000
(08:53 +0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Thu, 4 Feb 2016 07:53:22 +0000
(08:53 +0100)
plomlombot.py
patch
|
blob
|
history
diff --git
a/plomlombot.py
b/plomlombot.py
index 82f96a21e4c93b7371ef1669f749fd73c96afde0..64e46f8e42c8594d3be8748473fdfefecf827144 100755
(executable)
--- a/
plomlombot.py
+++ b/
plomlombot.py
@@
-185,14
+185,14
@@
def handle_command(command, argument, notice, target, session):
shuffle(usable_selections)
return usable_selections[0][select_length]
shuffle(usable_selections)
return usable_selections[0][select_length]
- def
purge
_undesired(tokens):
- for token in tokens:
- if None != re.match("^" + URLREGEX, token):
- del(tokens[tokens.index(token)])
+ def
malkovich
_undesired(tokens):
+
#
for token in tokens:
+
#
if None != re.match("^" + URLREGEX, token):
+
#
del(tokens[tokens.index(token)])
for name in session.uses_in_chan:
while True:
try:
for name in session.uses_in_chan:
while True:
try:
- del(tokens[tokens.index(name.lower())])
+ tokens[tokens.index(name.lower())] = "malkovich"
except ValueError:
break
return tokens
except ValueError:
break
return tokens
@@
-209,7
+209,7
@@
def handle_command(command, argument, notice, target, session):
for line in lines:
line = line.replace("\n", "").lower()
tokens += line.split()
for line in lines:
line = line.replace("\n", "").lower()
tokens += line.split()
- tokens =
purge
_undesired(tokens)
+ tokens =
malkovich
_undesired(tokens)
if len(tokens) <= select_length:
notice("NOT ENOUGH TEXT TO MARKOV.")
return
if len(tokens) <= select_length:
notice("NOT ENOUGH TEXT TO MARKOV.")
return