[lore] Add !scribe skeleton

This commit is contained in:
Eryn Wells 2016-09-25 13:11:01 -04:00
parent 855625d88c
commit 61c4af7d6d

View file

@ -16,7 +16,8 @@ MAX_PINS = 100
LORE_FILE = 'lore.json' LORE_FILE = 'lore.json'
CHANNELS = {} CHANNELS = {}
LORE_RE = re.compile(r'!lore(\s+(?P<count>\d+))') LORE_RE = re.compile(r'!lore\s+(?P<count>\d+)')
SCRIBE_RE = re.compile(r'!scribe\s+(?P<message>.*)')
outputs = [] outputs = []
@ -145,9 +146,14 @@ def process_message(data):
if lore: if lore:
for l in lore: for l in lore:
outputs.append([chid, l]) outputs.append([chid, l])
return
except KeyError as e: except KeyError as e:
LOGGER.error("Couldn't process !lore command: {}".format(e)) LOGGER.error("Couldn't process !lore command: {}".format(e))
m = SCRIBE_RE.match(text)
if m:
_scribe()
# #
# Private # Private
# #
@ -165,6 +171,10 @@ def _lore(channel, count):
out_lore.add(lore) out_lore.add(lore)
return out_lore return out_lore
def _scribe():
LOGGER.error('!scribe not implemented yet :-(')
pass
def _extract_lore(obj): def _extract_lore(obj):
if obj['type'] == 'message': if obj['type'] == 'message':
return obj['message']['permalink'] return obj['message']['permalink']