ilyas July Asked:2020-09-03 01:32:12 +0000 UTC2020-09-03 01:32:12 +0000 UTC 2020-09-03 01:32:12 +0000 UTC 电报机器人。使用消息历史记录 772 我怎样才能从用户那里得到以前的消息? telegram-bot 1 个回答 Voted Best Answer Anatol 2020-09-16T16:47:53Z2020-09-16T16:47:53Z 使用ForseReply和Messagereply_to_message对象的字段来组织多级菜单。示例(对于C#): public static ReplyMarkup ForceReply { get; } = new ForceReply { Force = true, Selective = true }; public static async Task AskUser(TelegramBotClient bot, Update update) { await bot.SendChatActionAsync(update.Message.Chat.Id, ChatAction.Typing); await bot.SendTextMessageAsync(update.Message.Chat.Id, "Type your answer", true, false, update.Message.MessageId, Keyboards.ForceReply); } //... if (update.Message.ReplyToMessage != null && update.Message.ReplyToMessage.Text.Contains("Type your answer")) { //do something with user data from update.Message.Text // ... await bot.SendChatActionAsync(update.Message.Chat.Id, ChatAction.Typing); await bot.SendTextMessageAsync(update.Message.Chat.Id, $"{update.Message.From.FirstName}, ok."); return; } 您也可以尝试此答案中建议的解决方案。
使用ForseReply和Message
reply_to_message对象的字段来组织多级菜单。示例(对于C#):您也可以尝试此答案中建议的解决方案。