我想知道是否有可能从电报频道获取消息,因为我知道我登录到这个帐户并且我是这个频道的管理员,所以我只想要获取消息。
import feedparser
from telegram import Update, ForceReply, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters, CallbackContext, CallbackQueryHandler
from bs4 import BeautifulSoup
from datetime import datetime
import json
import telegram
from time import sleep
from telegram.ext import MessageHandler, Filters
class Config:
def __init__(self):
with open("config.json", "r") as config:
self.config = json.load(config)
class TelegramBotChannel:
def __init__(self, token, start_channel_id):
self.updater = Updater(token=token, use_context=True)
self.dispatcher = self.updater.dispatcher
self.start_channel_id = start_channel_id
if __name__ == '__main__':
telegram_bot = TelegramBotChannel(Config().config["token"], Config().config["start"])
pass
答案 0 :(得分:0)
机器人只能获取频道帖子的更新,前提是他们是该频道的成员(并且机器人只能以管理员身份添加到频道)。如果他们是频道的管理员,他们会像其他聊天一样收到更新。