def add_to_history_tip(user_history, action, tip):
# convert object to string of name if necessary
if type(user_history) is models.User:
user_history = user_history.username
bot_logger.logger.info("Save for history user=%s, sender=%s, receiver=%s, amount=%s, action=%s, finish=%s" % (
user_history, tip.sender.username, tip.receiver.username, tip.amount, action, tip.finish))
db = TinyDB(config.history_path + user_history + '.json')
db.insert({
"user": user_history,
"id": tip.id,
"sender": tip.sender.username,
"receiver": tip.receiver.username,
"amount": tip.amount,
"action": action,
"finish": tip.finish,
"status": tip.status,
"tx_id": tip.tx_id,
'time': tip.time,
})
db.close()
评论列表
文章目录