From e428d3e0a07192f73cac0e8e0db19e936296b1cd Mon Sep 17 00:00:00 2001 From: urlbot Date: Sun, 21 Jun 2015 23:00:16 +0200 Subject: [PATCH] moin: rename, prepare for using string_constants --- plugins.py | 14 +++++++------- excuses.py => string_constants.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) rename excuses.py => string_constants.py (99%) diff --git a/plugins.py b/plugins.py index 2242d6b..6c28b95 100644 --- a/plugins.py +++ b/plugins.py @@ -11,7 +11,7 @@ import traceback import urllib.parse from local_config import conf, set_conf from common import * -from excuses import excuses +from string_constants import excuses from urlbot import extract_title from functools import wraps @@ -119,9 +119,9 @@ def parse_skynet(**args): 'msg': '''I'm an independent bot and have nothing to do with other artificial intelligence systems!''' } -@pluginfunction('moin', 'parse moin/bye', ptypes_PARSE) -def parse_moin_bye(**args): - moin = [ +@pluginfunction('moin', 'parse hi/bye', ptypes_PARSE) +def parse_moin(**args): + moin_strings_hi = [ 'Hi', 'Guten Morgen', 'Morgen', 'Moin', @@ -129,12 +129,12 @@ def parse_moin_bye(**args): 'NAbend', 'Abend', 'Hallo', 'Hello' ] - bye = [ + moin_strings_bye = [ 'Nacht', 'gN8', 'N8', 'bye', ] - for direction in [moin, bye]: + for direction in [moin_strings_hi, moin_strings_bye]: for d in direction: words = re.split(r'\W+', args['data']) @@ -159,7 +159,7 @@ def parse_moin_bye(**args): } log.plugin('sent %s reply for %s' % ( - 'moin' if direction is moin else 'bye', w + 'hi' if direction is moin_strings_hi else 'bye', w )) return { 'msg': '''%s, %s''' % ( diff --git a/excuses.py b/string_constants.py similarity index 99% rename from excuses.py rename to string_constants.py index 90b8d23..71a3bf5 100644 --- a/excuses.py +++ b/string_constants.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- if '__main__' == __name__: - print('''this is a excuse file, which is not meant to be executed''') + print('''this file just contains a bunch of strings and is not meant to be executed''') exit(-1) # retrived from http://pages.cs.wisc.edu/~ballard/bofh/excuses