handler.py
def sticker_handler(bot, update):
    '''
    Handler for the sticker messages
    Send message with sticker to all the followers who has more that 10 real_following
    '''
    def send_message_and_sticker(chat_id):
        '''
        Just a little handler to be sure that sticker will be send
        after the message
        '''
        bot.send_message(chat_id, RESPONSES['before_sticker_send'])
        bot.send_sticker(chat_id, sticker)

    username = str(update['message']['chat']['id'])
    sticker = update['message']['sticker']['file_id']
    users_to_send = table.scan(FilterExpression=Attr('follow').contains(username))['Items']
    if not users_to_send:
        return
    
    with ThreadPoolExecutor(max_workers=min(len(users_to_send), config.MAX_THREADS)) as Executor:
        list(Executor.map(send_message_and_sticker, 
                          [int(user['username']) for user in users_to_send]))
    logger.info('send_sticker_handler')

    Handler for the sticker messages
    Send message with sticker to all the followers who has more that 10 real_following
    
Handler for the sticker messages
Send message with sticker to all the followers who has more that 10 real_following
Handler for the sticker messages Send message with sticker to all the followers who has more that 10 real_following
def sticker_handler(bot, update):
    def send_message_and_sticker(chat_id):
        bot.send_message(chat_id, RESPONSES['before_sticker_send'])
        bot.send_sticker(chat_id, sticker)
    username = str(update['message']['chat']['id'])
    sticker = update['message']['sticker']['file_id']
    users_to_send = table.scan(FilterExpression=Attr('follow').contains(username))['Items']
    if not users_to_send:
        return
    with ThreadPoolExecutor(max_workers=min(len(users_to_send), config.MAX_THREADS)) as Executor:
        list(Executor.map(send_message_and_sticker, 
                          [int(user['username']) for user in users_to_send]))
    logger.info('send_sticker_handler')
def sticker_handler ( bot , update ) : def send_message_and_sticker ( chat_id ) : '''
        Just a little handler to be sure that sticker will be send
        after the message
        ''' bot . send_message ( chat_id , RESPONSES [ 'before_sticker_send' ] ) bot . send_sticker ( chat_id , sticker ) username = str ( update [ 'message' ] [ 'chat' ] [ 'id' ] ) sticker = update [ 'message' ] [ 'sticker' ] [ 'file_id' ] users_to_send = table . scan ( FilterExpression = Attr ( 'follow' ) . contains ( username ) ) [ 'Items' ] if not users_to_send : return with ThreadPoolExecutor ( max_workers = min ( len ( users_to_send ) , config . MAX_THREADS ) ) as Executor : list ( Executor . map ( send_message_and_sticker , [ int ( user [ 'username' ] ) for user in users_to_send ] ) ) logger . info ( 'send_sticker_handler' )
Handler for the sticker messages
Send message with sticker to all the followers who has more that 10 real_following
Handler for the sticker messages Send message with sticker to all the followers who has more that 10 real_following
'''
    Handler for the sticker messages
    Send message with sticker to all the followers who has more that 10 real_following
    ''' '''
        Just a little handler to be sure that sticker will be send
        after the message
        '''
bot
update