Search code examples
pythontelegrampy-telegram-bot-api

telegram bot: how should i get user feedback after forcereply?


#!/usr/bin/env python3
#-*- encoding: utf-8 -*-

from apikey import tgbottoken,authedchat
from telebot import types
import telebot,logging

bot =telebot.TeleBot(tgbottoken)
telebot.logger.setLevel(logging.DEBUG)


def extract_arg(arg):
    return arg.split()[1:]

@bot.message_handler(commands=['newmail'])
def mailwithsg(msg):
    cid = msg.chat.id
    sendto = types.ForceReply(selective=False)
    bot.send_message(cid, "Send me another word:", reply_markup=sendto)

bot.polling(none_stop=True)

after I use the methods and send a reply markup message, how should I get user's reply text (like user feedback)? which method should I use?

I now use pyTelegramBotAPI as a Python Wrapper.


Solution

  • It will reply a normal message.

    Only Inline Keyboard should use CallBackQuery to handle it.

    So that just use message_id to identify all messages and do what you want.