示例#1
0
文件: app.py 项目: yaojiach/butler
def index():
    ldb = LiteDB()
    d = ldb.get_one()
    return render_template('index.html',
                           title='Butler',
                           timestamp=d['ts'],
                           state=d['st'])
示例#2
0
def handler(cmd, chn):
    resp = 'All I can say is that it\'s a bouillon spoon'
    kw = ['water', 'temperature', 'ready']
    if any(w in cmd for w in kw):
        ldb = LiteDB()
        d = ldb.get_one()
        resp = 'Last time I checked ({ts}), it was {st}'.format(ts=d['ts'],
                                                                st=d['st'])
    slackc.api_call('chat.postMessage', as_user=True, channel=chn, text=resp)