我被困在我的代码中,因为我不知道如何输入/导出我的机器人转发的传出消息的 message_id。
背景:这只是我的代码的一部分,我随后会将其集成到主代码中。这里,我正在测试转发消息+删除消息的功能。我能够成功地将它们转发出去,但我坚持删除它们。我可以提供 chat_id 的输入,但无法删除要删除的 message_id。有没有办法做到这一点,特别是当我要集成到我的主脚本中时,它可以有几个组来管理。请帮助我这个菜鸟。谢谢你!
我的脚本:
import logging
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
from telegram.ext import (
Updater,
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
CallbackContext,
)
TOKEN = "PUT TOKEN HERE" #INPUT HERE
# Enable logging
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)
logger = logging.getLogger(__name__)
MSG, DELETE_MSG = range(2)
def start(update: Update, context: CallbackContext) -> int:
update.message.reply_text(
'Hi! Please post the message you would like to share:')
return MSG
def send(update: Update, context: CallbackContext) -> int:
user …Run Code Online (Sandbox Code Playgroud)