handler.py
def document_handler(bot, update):
    '''
    Handler for the document messages
    Send message with photo to all the followers who has more that 10 real_following
    '''
    document = update['message']['document']['file_id']
    username = str(update['message']['chat']['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(lambda x: bot.send_document(*x), 
                          [(int(user['username']), document) 
                          for user in users_to_send]))
    logger.info('send_document_handler')

    Handler for the document messages
    Send message with photo to all the followers who has more that 10 real_following
    
Handler for the document messages
Send message with photo to all the followers who has more that 10 real_following
Handler for the document messages Send message with photo to all the followers who has more that 10 real_following
def document_handler(bot, update):
    document = update['message']['document']['file_id']
    username = str(update['message']['chat']['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(lambda x: bot.send_document(*x), 
                          [(int(user['username']), document) 
                          for user in users_to_send]))
    logger.info('send_document_handler')
def document_handler ( bot , update ) : document = update [ 'message' ] [ 'document' ] [ 'file_id' ] username = str ( update [ 'message' ] [ 'chat' ] [ '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 ( lambda x : bot . send_document ( * x ) , [ ( int ( user [ 'username' ] ) , document ) for user in users_to_send ] ) ) logger . info ( 'send_document_handler' )
Handler for the document messages
Send message with photo to all the followers who has more that 10 real_following
Handler for the document messages Send message with photo to all the followers who has more that 10 real_following
'''
    Handler for the document messages
    Send message with photo to all the followers who has more that 10 real_following
    '''
bot
update