如何删除回复键盘(Telegram Bot)

时间:2017-09-29 17:58:44

标签: python-2.7 telegram telegram-bot

我只需要url删除ReplyKeyboard。

我使用的是Python而不是Python BotLibrary。我完成所有工作,因为我想要充分的灵活性。

2 个答案:

答案 0 :(得分:4)

我查了一下并用PHP快速测试了它,希望这会有所帮助:

// ACF custom field excerpt
function review_excerpt() {
    global $post;
    $text = get_field('review'); //Replace 'your_field_name'
    if ( '' != $text ) {
        $text = strip_shortcodes( $text );
        $text = apply_filters('the_content', $text);
        $text = str_replace(']]>', ']]>', $text);
        $permalink = get_permalink($post->ID);
        $excerpt_length = 60; // 20 words
        $excerpt_more = apply_filters('excerpt_more', ' ' . '<a href="'.$permalink.'" rel="nofollow"><br>Lees Meer</a>');
        $text = wp_trim_words( $text, $excerpt_length, $excerpt_more );
    }
    return apply_filters('the_excerpt', $text);
}

// foto vergelijking ophalen en als object weergeven.
function get_foto($image){    
     if( !empty($image) ) {
         echo $image['url'];
     }    
}

/* Registreer Recensies
----------------------------------------------------------------------*/
$labels = array(
    'name' => 'Recensies',
    'singular_name' => 'Recensie',
    'add_new' => 'Recensie toevoegen',
    'add_new_item' => 'Quote',
    'edit_item' => 'Wijzig recensie',
    'new_item' => 'Nieuwe recensie',
    'view_item' => 'Bekijk recensie',
    'search_items' => 'Zoek recensie',
    'not_found' =>  'Geen recensie gevonden',
    'not_found_in_trash' => 'Geen recensie in de prullenbak gevonden',
    'parent_item_colon' => '',
    'menu_name' => 'Recensies'
);

register_post_type('recensies',array(
    'public'=>true,
    'show_in_menu'=>true,   
    'show_ui'=>true,
    'labels'=>$labels,
    'hierarchical' => false,
    'supports'=>array('title'),
    'capability_type' => 'post',
    /* developer.wordpress.org/resource/dashicons */
    'menu_icon' => 'dashicons-editor-quote',
    'taxonomies'=>array(),
    'exclude_from_search'=>false,
    'rewrite'=>true,
    'rewrite'=>array( 'slug' => 'recensies', 'with_front' => true ),
    'menu_position' => 4
    )
);


/* Registers picture before and after they have been posted. 
----------------------------------------------------------------------*/
$labels = array(
    'name' => 'Foto vergelijking',
    'singular_name' => 'Foto vergelijking',
    'add_new' => 'Foto Voor en Na toevoegen',
    'add_new_item' => 'Foto Voor en Na',
    'edit_item' => 'Wijzig foto vergelijking',
    'new_item' => 'Nieuwe foto vergelijking',
    'view_item' => 'Bekijk foto vergelijking',
    'search_items' => 'Zoek foto vergelijking',
    'not_found' =>  'Geen foto vergelijking gevonden',
    'not_found_in_trash' => 'Geen foto vergelijking in de prullenbak gevonden',
    'parent_item_colon' => '',
    'menu_name' => 'Foto Voor en Na'
);

register_post_type('fotovergelijking',array(
    'public'=>true,
    'show_in_menu'=>true,   
    'show_ui'=>true,
    'labels'=>$labels,
    'hierarchical' => false,
    'supports'=>array('title'),
    'capability_type' => 'post',
    /* developer.wordpress.org/resource/dashicons */
    'menu_icon' => 'dashicons-format-gallery',
    'taxonomies'=>array(),
    'exclude_from_search'=>false,
    'rewrite'=>true,
    'rewrite'=>array( 'slug' => 'voorenna', 'with_front' => true ),
    'menu_position' => 4
    )
);


?>

Python中的URL逻辑与PHP中的相同,您只需调整JSON编码函数(...)。

答案 1 :(得分:0)

您可以sendMessage通过HTTPS请求ReplyKeyboardRemove