mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
parse_moin_bye(): limit matching to full words
This commit is contained in:
24
plugins.py
24
plugins.py
@@ -134,13 +134,23 @@ def parse_moin_bye(**args):
|
|||||||
|
|
||||||
for direction in [moin, bye]:
|
for direction in [moin, bye]:
|
||||||
for d in direction:
|
for d in direction:
|
||||||
if d.lower() in args['data'].lower() and len(args['data'].split()) < 3:
|
words = re.split(r'\W+', args['data'])
|
||||||
logger('plugin', 'sent %s reply' % (
|
|
||||||
'moin' if direction is moin else 'bye'
|
# assumption: longer sentences are not greetings
|
||||||
))
|
if 3 < len(args['data'].split()):
|
||||||
return {
|
continue
|
||||||
'msg': '''%s, %s''' % (random.choice(direction), args['reply_user'])
|
|
||||||
}
|
for w in words:
|
||||||
|
if d.lower() == w.lower():
|
||||||
|
logger('plugin', 'sent %s reply for %s' % (
|
||||||
|
'moin' if direction is moin else 'bye', w
|
||||||
|
))
|
||||||
|
return {
|
||||||
|
'msg': '''%s, %s''' % (
|
||||||
|
random.choice(direction),
|
||||||
|
args['reply_user']
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@pluginfunction('latex', r'reacts on \LaTeX', ptypes_PARSE)
|
@pluginfunction('latex', r'reacts on \LaTeX', ptypes_PARSE)
|
||||||
def parse_latex(**args):
|
def parse_latex(**args):
|
||||||
|
|||||||
Reference in New Issue
Block a user