fix confirm

This commit is contained in:
2024-04-28 01:26:43 +08:00
parent 0ca9b55ea8
commit 40877b52eb
+5 -8
View File
@@ -2,7 +2,7 @@ import html
from functools import wraps from functools import wraps
from aiohttp import ClientSession from aiohttp import ClientSession
from telegram import Update, Chat, InlineKeyboardMarkup, InlineKeyboardButton, ForceReply, Message from telegram import Update, Chat, InlineKeyboardMarkup, InlineKeyboardButton, Message
from telegram.constants import ParseMode, ChatAction, ChatType from telegram.constants import ParseMode, ChatAction, ChatType
from telegram.ext import ( from telegram.ext import (
Application, Application,
@@ -56,8 +56,10 @@ async def url_media(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
url = tweet.url url = tweet.url
if context.user_data.get('edit_before_forward', False): if context.user_data.get('edit_before_forward', False):
message_reply = await update.effective_message.reply_text( message_reply = await update.effective_message.reply_text(
"Reply to edit message.", "Reply to edit message. [URL]",
reply_markup=ForceReply(selective=True, input_field_placeholder="[URL]"), reply_markup=InlineKeyboardMarkup.from_button(
InlineKeyboardButton("↩️ Confirm", callback_data="forward")
),
reply_to_message_id=update.message.message_id, reply_to_message_id=update.message.message_id,
) )
context.user_data['message_reply'] = message_reply context.user_data['message_reply'] = message_reply
@@ -96,11 +98,6 @@ async def edit_message(update: Update, context: ContextTypes.DEFAULT_TYPE) -> No
) + update_text[match[1]:] ) + update_text[match[1]:]
message_to_send = context.user_data['message_to_send'] message_to_send = context.user_data['message_to_send']
await message_to_send[0].edit_caption(update_text) await message_to_send[0].edit_caption(update_text)
await context.user_data['message_reply'].edit_reply_markup(
InlineKeyboardMarkup.from_button(
InlineKeyboardButton("↩️ Confirm", callback_data="forward")
)
)
async def query_forward_message(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: async def query_forward_message(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None: