Esempio n. 1
0
def log_user(client, message):
    chat = message.chat
    chats_db.update_user(message.from_user.id, message.from_user.username,
                         chat.id, chat.title)

    if message.reply_to_message:
        chats_db.update_user(message.reply_to_message.from_user.id,
                             message.reply_to_message.from_user.username,
                             chat.id, chat.title)

    if message.forward_from:
        chats_db.update_user(message.forward_from.id,
                             message.forward_from.username)
Esempio n. 2
0
def log_user(bot: Bot, update: Update):
    chat = update.effective_chat  # type: Optional[Chat]
    msg = update.effective_message  # type: Optional[Message]

    sql.update_user(msg.from_user.id, msg.from_user.username, chat.id,
                    chat.title)

    if msg.reply_to_message:
        sql.update_user(msg.reply_to_message.from_user.id,
                        msg.reply_to_message.from_user.username, chat.id,
                        chat.title)

    if msg.forward_from:
        sql.update_user(msg.forward_from.id, msg.forward_from.username)