def event_text(): start_time = time() with db.session.no_autoflush: EventText(**request.json).start() return 'ok'
def event_text(): start_time = time() try: reply_message = EventText(**request.json).run() except Exception as e: bots[request.json['bot_id']].reply_message(request.json['reply_token'], '愛醬出錯了!\n作者可能會察看此錯誤報告') bots['admin'].send_message(cfg['admin_line'], '<愛醬BUG>\n%s' % str(e)) raise e if len(reply_message) == 0: abort(400) return '\n'.join(reply_message)
def handle_image(event): EventText(**get_id(event), bot_id=token, reply_token=event.reply_token, message=None, sticker=None, image=1, message_id=event.message.id).run() return 'ok'
def handle_sticker(event): EventText(**get_id(event), bot_id=token, reply_token=event.reply_token, message=None, sticker=1, image=None).run() return 'ok'
def handle_message(event): EventText(**get_id(event), bot_id=token, reply_token=event.reply_token, message=event.message.text).run() return 'ok'
def event_image(): EventText(message=None, sticker=None, image=1, **request.json).run() #MessageLogs.add(request.json['group_id'], request.json['user_id'], nImage=1) #db.session.commit() return 'ok'
def event_image(): with db.session.no_autoflush: EventText(message=None, sticker=None, image=1, **request.json).start() return 'ok'