• Resolved bymar76

    (@bymar76)


    hello,
    have I to adopt php code to answer to bot messasge in dynamic way? is it correct? Is it possible have simple php code in order to:
    – read command
    – print back txt related command.

    for eg:
    message: /spinning
    answer: today spinning is at 10am

    message: /course spinning tomorrow
    answer: tomorrow spinning is at 15pm

    Thanks,
    Marco.

    https://www.ads-software.com/plugins/telegram-bot/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Marco Milesi

    (@milmor)

    Hi,
    create a file called telegram-bot-custom.php and upload it to wp-content/plugins, then activate it.

    Write the file as follows:

    <?php
    /*
    Plugin Name: Telegram Bot & Channel (Custom)
    Description: My Custom Telegram Plugin
    Author: My name
    Version: 1
    */
    
    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 ( $text == '/spinning') {
            telegram_sendmessage( $telegram_user_id, 'today spinning is at 10am');
        }
    
        return;
    }
    
    ?>

    Thread Starter bymar76

    (@bymar76)

    Thanks for your tips, it works well ??

    I’m wondering if I could develop an interaction like this:
    user:/course tomorrow
    bot: what course for tomorrow?
    [spinning]
    [pump]
    [yoga]
    user:yoga
    bot: tomorrow yoga is at 9am, you’re welcome!

    is it possible? I didn’t find any function ready to use within custom keyboard.

    Thanks in advance for you great job!

    Marco.

    Plugin Author Marco Milesi

    (@milmor)

    You can create /course in your commands page with keyboard markup spinning;pump;yoga. Then use php as i described for these 3 commands ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to setup dynamic answer to mybot message’ is closed to new replies.