Closed mrismanaziz closed 2 years ago
Proper support for Bot API 5.5 will be added in #2808, but that didn't change the way channels send messages in groups. All you have to check is if sender_chat
from the Message object is set to something. I didn't really get the rest of your question, if my answer doesn't clear it up, try rephrasing your question please.
i mean, when i send message in group by using channel, provided by telegram beta version 3.8.0, when i use sender_chat , channel user id is detected as 77700 where it is telegram id not channel chat id
Actually Bot API 5.5 haven't implemented in PTB yet, so how can you expect a bug related to new API in PTB?
You're apparently not using the Message.sender_chat
attribute, bot the from_user
attribute. Consider this minimal example:
import html
import json
from telegram import ParseMode
from telegram.ext import Updater, MessageHandler, Filters
def callback(update, _):
update.effective_message.reply_text(f'<pre>update = {html.escape(json.dumps(update.to_dict(), indent=2, ensure_ascii=False))}</pre>', parse_mode=ParseMode.HTML)
def main():
updater = Updater('TOKEN')
updater.dispatcher.add_handler(MessageHandler(Filters.all, callback))
updater.start_polling(drop_pending_updates=True)
updater.idle()
if __name__ == '__main__':
main()
This just replies the raw json-data received from Telegram to each message. If you run this example, you'll notice that the json data lists Telegram with id 777000 as from
, but lists the channel as sender_chat
- the latter is exactly what the API update promises.
You can see an example of this at https://t.me/roolstest_offtopic.
You are somewhat right about the fact that 777000 should not be reported as from
user for those messages: https://core.telegram.org/bots/api-changelog#november-4-2020 states
For backward compatibility in non-channel chats, the field
from
in such messages will contain the user 777000 for messages automatically forwarded to the discussion group […]
which strictly speaking doesn't cover the new send-by-a-channel messages. However, changing this would be the job of Telegram - PTB has no say in this. You can file a report at bugs.telegram.org or github.com/tdlib/bot-api.
Then again, this is for backwards compatibility only anyway, so you should just use sender_chat
when that field is set.
oke thanks you
Steps to Reproduce
Expected behaviour
I want the ptb to fix the detect id to the chat id of the channel or none
Actual behaviour
I am a user of Telegram beta version 3.8.0, in Telegram beta there is a new feature, namely sending messages in groups using channels. when I use message info from the channel I'm on. ptb detects the channel as id 777000 which means as telegram, where the id is id lord. I can be an admin in a group that I am not an admin what if the group management bot adds the telegram id to the decorator is admin.
Operating System
Telegram Beta v8.3.0
Version of Python, python-telegram-bot & dependencies
Relevant log output
No response
Additional Context
No response