bot.get_chat_administrators seems to return ChatMember instance for public channels. I need role of my bot in private channels.
Asked
Active
Viewed 351 times
1 Answers
0
if send message works bot should be admin in the channel. https://python-telegram-bot.readthedocs.io/en/stable/telegram.bot.html#telegram.Bot.send_message
but in my case it didn't work. so I referred to official api:
import requests
from telegram import Bot
TOKEN = "YOUR_TOKEN"
bot = Bot(token=TOKEN)
def send_message_to_private(chat_id, text):
api = f'https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id={chat_id}&text={text}'
response = requests.get(api).json()
return response['result']

OuzKagan
- 482
- 4
- 8