I have used this snippet
add_action('telegram_parse','telegramcustom_parse', 10, 2);
function telegramcustom_parse( $telegram_user_id, $text ) {
$plugin_post_id = telegram_getid( $telegram_user_id );
if ( !$plugin_post_id ) {
return;
}
if ( get_post_meta( $plugin_post_id, 'telegram_custom_state', true ) == 'tablenumber_wait' ) {
if ( is_numeric( $text) && $text < 30 ) {
$table = sanitize_text_field( $text );
update_post_meta( $plugin_post_id, 'telegram_custom_tablenumber', $table );
delete_post_meta( $plugin_post_id, 'telegram_custom_state' ); //Or set "telegram_custom_state" to something else
die(); //You can comment this if you want to parse other commands
} else {
telegram_sendmessage( $telegram_user_id, 'Numero troppo alto. Per quante persone vuoi prenotare?');
die(); //You can comment this if you want to parse other commands
}
} else if ( !get_post_meta( $plugin_post_id, 'telegram_custom_tablenumber' ) ) {
telegram_sendmessage( $telegram_user_id, 'Per quante persone vuoi prenotare?');
update_post_meta( $plugin_post_id, 'telegram_custom_state', 'tablenumber_wait' );
die(); //You can comment this if you want to parse other commands
}
return;
}
to insert how many person book the restaurant table but it works immediately when u add the bot instead I want linked to a command and when your”telegram_custom_tablenumber” is filled is stopped to work, It work again after I delete the custom field in the subscriber page details
I need also to add other 2 question, like insert your phone number and when book the table can you help me?
thanks