handler.py
def send_command_handler(bot, update):
    '''
    Handler for the "send" command
    Send message to all the followers who has more that 10 real_following
    '''
    message = update['message']['text'][len('/send'):]
    if not message:
        chat_id = update['message']['chat']['id']
        bot.send_message(chat_id, RESPONSES['empty_send_command'])
        return 

    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_message(*x), 
                          [(int(user['username']), RESPONSES['message_boilerplate'].format(message)) 
                           for user in users_to_send]))
    # for user in users_to_send:
        # bot.send_message(int(user['username']), f'Somebody told me, that "{message}"')
    logger.info('send_command_handler')

    Handler for the "send" command
    Send message to all the followers who has more that 10 real_following
    
Handler for the "send" command
Send message to all the followers who has more that 10 real_following
Handler for the " send " command Send message to all the followers who has more that 10 real_following
def send_command_handler(bot, update):
    message = update['message']['text'][len('/send'):]
    if not message:
        chat_id = update['message']['chat']['id']
        bot.send_message(chat_id, RESPONSES['empty_send_command'])
        return 
    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_message(*x), 
                          [(int(user['username']), RESPONSES['message_boilerplate'].format(message)) 
                           for user in users_to_send]))
    logger.info('send_command_handler')
def send_command_handler ( bot , update ) : message = update [ 'message' ] [ 'text' ] [ len ( '/send' ) : ] if not message : chat_id = update [ 'message' ] [ 'chat' ] [ 'id' ] bot . send_message ( chat_id , RESPONSES [ 'empty_send_command' ] ) return 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_message ( * x ) , [ ( int ( user [ 'username' ] ) , RESPONSES [ 'message_boilerplate' ] . format ( message ) ) for user in users_to_send ] ) ) logger . info ( 'send_command_handler' )
Handler for the "send" command
Send message to all the followers who has more that 10 real_following
Handler for the " send " command Send message to all the followers who has more that 10 real_following
'''
    Handler for the "send" command
    Send message to all the followers who has more that 10 real_following
    ''' # for user in users_to_send: # bot.send_message(int(user['username']), f'Somebody told me, that "{message}"')
bot
update