def handle_stream_send_message(json): sql.Dialog(text=json['text'], chat_id=json['chat_id'], first_name=json['user'], time=-1, sender=f"admin:{json['user']}").save() emit('stream_send_message', { "chat_id": json['chat_id'], "sent": bot.send_message(json['chat_id'], json['text']) })
def sendMessage(chat_id, text): sql.Dialog(text=text, chat_id=chat_id, first_name='Администратор', time=-1).save() return { "sent": True, "chat_id": chat_id } if bot.send_message(chat_id, text) else { "sent": False, "chat_id": chat_id }
def flow(message): sql.Dialog(text=message.text, chat_id=message.from_user.id, first_name=message.from_user.first_name, time=-1, sender=f"customer:{message.from_user.id}").save()
def function_name(message): sql.Dialog(text=message.text, chat_id=message.from_user.id, first_name=message.from_user.first_name, time=-1).save()
def service_message(message, chat_id, type='start'): sql.Dialog(text=message, chat_id=chat_id, first_name='', time=-1, sender=f"service:{type}").save()
def function_name(message): print(message) sql.Dialog(text=message.text).save()
def function_name(message): print(message) sql.Dialog(text=message.text, chat_id=message.from_user.id).save()
def sendMessage(chat_id, text): sql.Dialog(text=text, chat_id=chat_id, first_name='Администратор', time=-1).save()