This commit is contained in:
Thorsten
2015-11-28 15:43:33 +01:00
parent a2e7789e49
commit c4c59dd243

View File

@@ -969,36 +969,26 @@ def recognize_bots(**args):
'new Debian Security Announce', 'new Debian Security Announce',
'I\'m a bot (highlight me', 'I\'m a bot (highlight me',
) )
def _add_to_list(username, message):
blob = conf_load()
if 'other_bots' not in blob:
blob['other_bots'] = []
if username not in blob['other_bots']:
blob['other_bots'].append(username)
conf_save(blob)
return {
'event': {
'time': time.time() + 3,
'msg': message
}
}
if any([phrase in args['data'] for phrase in unique_standard_phrases]): if any([phrase in args['data'] for phrase in unique_standard_phrases]):
_add_to_list(args['reply_user'], 'Making notes...')
blob = conf_load()
if 'other_bots' not in blob:
blob['other_bots'] = []
if args['reply_user'] not in blob['other_bots']:
blob['other_bots'].append(args['reply_user'])
conf_save(blob)
return {
'event': {
'time': time.time() + 3,
'msg': 'Making notes...'
}
}
elif 'I\'ll be back' in args['data']: elif 'I\'ll be back' in args['data']:
# a buddy! _add_to_list(args['reply_user'], 'Hey there, buddy!')
blob = conf_load()
if 'other_bots' not in blob:
blob['other_bots'] = []
if args['reply_user'] not in blob['other_bots']:
blob['other_bots'].append(args['reply_user'])
conf_save(blob)
return {
'event': {
'time': time.time() + 3,
'msg': 'Hey there, buddy!'
}
}
@pluginfunction("remove-from-botlist", "remove a user from the botlist", ptypes_COMMAND) @pluginfunction("remove-from-botlist", "remove a user from the botlist", ptypes_COMMAND)