bot.py
def process_text_from_message(update: Update, context: CallbackContext) -> None:
    """
    After receiving a text message, depending on th amount of the previously
    sent messages, add the text on the image or sends the notification.

    :param update: represents an incoming update
    :param context: context of the processed message
    :return: None
    """
    global SELECTED_FONT_SIZE
    global SELECTED_FONT
    global FONTS_SIZE
    user_id = update.message.chat.id
    text = update.message.text
    try:
        if count_user_images(user_id) == 1:
            url = get_final_image_url(user_id, text, SELECTED_FONT, SELECTED_FONT_SIZE)
            s3.upload_file(url, BUCKET, url)
            send_image(update, context, url)
            os.remove(url)
            USERS_INFO[user_id]["sent_images"] = 0
            SELECTED_FONT = None
            SELECTED_FONT_SIZE = None
            collect_statistics(user_id, "добавление текста на изображение")
        elif count_user_images(user_id) > 1:
            message = "Отправьте еще одно изображение или нажмите кнопку"
            keyboard = choose_GIF_type_keyboard
            reply_markup = InlineKeyboardMarkup(keyboard)
            context.bot.send_message(
                chat_id=user_id,
                text=message,
                reply_markup=reply_markup,
            )
        elif count_user_images(user_id) == 0:
            if text[:10].lower() == "статистика":
                message = analysis(text)
                send_message(update, context, message)
            else:
                send_message(update, context, "Сначала отправьте изображение")
    except Exception as e:
        logger.exception(e)

    After receiving a text message, depending on th amount of the previously
    sent messages, add the text on the image or sends the notification.

    :param update: represents an incoming update
    :param context: context of the processed message
    :return: None
    
After receiving a text message, depending on th amount of the previously
sent messages, add the text on the image or sends the notification.
After receiving a text message depending on th amount of the previously sent messages add the text on the image or sends the notification .
def process_text_from_message(update: Update, context: CallbackContext) -> None:
    global SELECTED_FONT_SIZE
    global SELECTED_FONT
    global FONTS_SIZE
    user_id = update.message.chat.id
    text = update.message.text
    try:
        if count_user_images(user_id) == 1:
            url = get_final_image_url(user_id, text, SELECTED_FONT, SELECTED_FONT_SIZE)
            s3.upload_file(url, BUCKET, url)
            send_image(update, context, url)
            os.remove(url)
            USERS_INFO[user_id]["sent_images"] = 0
            SELECTED_FONT = None
            SELECTED_FONT_SIZE = None
            collect_statistics(user_id, "добавление текста на изображение")
        elif count_user_images(user_id) > 1:
            message = "Отправьте еще одно изображение или нажмите кнопку"
            keyboard = choose_GIF_type_keyboard
            reply_markup = InlineKeyboardMarkup(keyboard)
            context.bot.send_message(
                chat_id=user_id,
                text=message,
                reply_markup=reply_markup,
            )
        elif count_user_images(user_id) == 0:
            if text[:10].lower() == "статистика":
                message = analysis(text)
                send_message(update, context, message)
            else:
                send_message(update, context, "Сначала отправьте изображение")
    except Exception as e:
        logger.exception(e)
def process_text_from_message ( update : Update , context : CallbackContext ) -> None : global SELECTED_FONT_SIZE global SELECTED_FONT global FONTS_SIZE user_id = update . message . chat . id text = update . message . text try : if count_user_images ( user_id ) == 1 : url = get_final_image_url ( user_id , text , SELECTED_FONT , SELECTED_FONT_SIZE ) s3 . upload_file ( url , BUCKET , url ) send_image ( update , context , url ) os . remove ( url ) USERS_INFO [ user_id ] [ "sent_images" ] = 0 SELECTED_FONT = None SELECTED_FONT_SIZE = None collect_statistics ( user_id , "добавление текста на изображение") elif count_user_images ( user_id ) > 1 : message = "Отправьте еще одно изображение или нажмите кнопку" keyboard = choose_GIF_type_keyboard reply_markup = InlineKeyboardMarkup ( keyboard ) context . bot . send_message ( chat_id = user_id , text = message , reply_markup = reply_markup , ) elif count_user_images ( user_id ) == 0 : if text [ : 10 ] . lower ( ) == "статистика": message = analysis ( text ) send_message ( update , context , message ) else : send_message ( update , context , "Сначала отправьте изображение") except Exception as e : logger . exception ( e )
After receiving a text message, depending on th amount of the previously
sent messages, add the text on the image or sends the notification.
After receiving a text message depending on th amount of the previously sent messages add the text on the image or sends the notification .
"""
    After receiving a text message, depending on th amount of the previously
    sent messages, add the text on the image or sends the notification.

    :param update: represents an incoming update
    :param context: context of the processed message
    :return: None
    """
None
update
Update
represents an incoming update
represents an incoming update
context
CallbackContext
context of the processed message
context of the processed message