【问题标题】:telegram bot: how should i get user feedback after forcereply?电报机器人:我应该如何在强制回复后获得用户反馈?
【发布时间】:2020-09-23 00:12:36
【问题描述】:
#!/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)

使用方法并发送回复标记消息后,我应该如何获取用户的回复文本(如用户反馈)?我应该使用哪种方法?

我现在使用 pyTelegramBotAPI 作为 Python Wrapper。

【问题讨论】:

  • 只收到一条正常的短信。您可以询问库开发人员。

标签: python telegram py-telegram-bot-api


【解决方案1】:

它会回复一条正常的消息。

内联键盘应该使用 CallBackQuery 来处理它。

因此,只需使用 message_id 来识别所有消息并执行您想要的操作。

【讨论】:

    【解决方案2】:

    使用我的 php 方法 - 我想你可以将它翻译成 python;

    switch($reply_to_message_text)
       case 'Send me another word:':
            $usersreply =  $message ;
            $this->db->addfeedback($user_id,$usersreply)
    
         --------->here you can send some text to user and say Thanks)
    

    【讨论】:

      猜你喜欢
      • 2018-12-27
      • 1970-01-01
      • 2021-08-18
      • 2017-11-04
      • 2021-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-11
      相关资源
      最近更新 更多