moin: rename, prepare for using string_constants
This commit is contained in:
14
plugins.py
14
plugins.py
@@ -11,7 +11,7 @@ import traceback
|
|||||||
import urllib.parse
|
import urllib.parse
|
||||||
from local_config import conf, set_conf
|
from local_config import conf, set_conf
|
||||||
from common import *
|
from common import *
|
||||||
from excuses import excuses
|
from string_constants import excuses
|
||||||
from urlbot import extract_title
|
from urlbot import extract_title
|
||||||
from functools import wraps
|
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!'''
|
'msg': '''I'm an independent bot and have nothing to do with other artificial intelligence systems!'''
|
||||||
}
|
}
|
||||||
|
|
||||||
@pluginfunction('moin', 'parse moin/bye', ptypes_PARSE)
|
@pluginfunction('moin', 'parse hi/bye', ptypes_PARSE)
|
||||||
def parse_moin_bye(**args):
|
def parse_moin(**args):
|
||||||
moin = [
|
moin_strings_hi = [
|
||||||
'Hi',
|
'Hi',
|
||||||
'Guten Morgen', 'Morgen',
|
'Guten Morgen', 'Morgen',
|
||||||
'Moin',
|
'Moin',
|
||||||
@@ -129,12 +129,12 @@ def parse_moin_bye(**args):
|
|||||||
'NAbend', 'Abend',
|
'NAbend', 'Abend',
|
||||||
'Hallo', 'Hello'
|
'Hallo', 'Hello'
|
||||||
]
|
]
|
||||||
bye = [
|
moin_strings_bye = [
|
||||||
'Nacht', 'gN8', 'N8',
|
'Nacht', 'gN8', 'N8',
|
||||||
'bye',
|
'bye',
|
||||||
]
|
]
|
||||||
|
|
||||||
for direction in [moin, bye]:
|
for direction in [moin_strings_hi, moin_strings_bye]:
|
||||||
for d in direction:
|
for d in direction:
|
||||||
words = re.split(r'\W+', args['data'])
|
words = re.split(r'\W+', args['data'])
|
||||||
|
|
||||||
@@ -159,7 +159,7 @@ def parse_moin_bye(**args):
|
|||||||
}
|
}
|
||||||
|
|
||||||
log.plugin('sent %s reply for %s' % (
|
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 {
|
return {
|
||||||
'msg': '''%s, %s''' % (
|
'msg': '''%s, %s''' % (
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
if '__main__' == __name__:
|
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)
|
exit(-1)
|
||||||
|
|
||||||
# retrived from http://pages.cs.wisc.edu/~ballard/bofh/excuses
|
# retrived from http://pages.cs.wisc.edu/~ballard/bofh/excuses
|
||||||
Reference in New Issue
Block a user