好吧,我知道这是个新手问题,但我已经被困了一段时间了
我刚开始使用pythonTelegarmapi,但我不知道如何获取message_id
的消息。我该怎么做
import os
import telebot
API_KEY = "API_KEY"
# Getting the bot instance
bot = telebot.TeleBot(API_KEY)
# Forward mesasage
# From https://core.telegram.org5/bots/api#forwardmessage
@bot.message_handler(commands=['forward'])
def forward(message):
bot.forward_message('@send_to','@from', 1, False)
^^^
# Here is supposed to be the message_id but I don't know how to get that.
"""
那么,如何使用Python Telegram Bot Api检索聊天室/频道中特定消息的ID呢
您需要:
其中
mydebugid
是要转发到的ID函数接收的是
message
参数message.message_id
应该可以做到这一点,另请参见https://github.com/eternnoir/pyTelegramBotAPI#types。请注意,您可能应该传递message.chat.id
,而不是'@from'
,因为IISC您的代码片段不能保证message
将是由用户名'@from'
标识的聊天中发送的消息相关问题 更多 >
编程相关推荐