Exemplo n.º 1
0
def index():
    ldb = LiteDB()
    d = ldb.get_one()
    return render_template('index.html',
                           title='Butler',
                           timestamp=d['ts'],
                           state=d['st'])
Exemplo n.º 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)
Exemplo n.º 3
0
 def save_db(self):
     ldb = LiteDB()
     ts = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
     ldb.post(ts=ts, st=self.rslt)