簡體   English   中英

如何在電報機器人 python 中獲取其他聊天組中的頻道名稱?

[英]How to get name of the channel in other's chat group in telegram bot python?

我正在嘗試獲取將消息發送到其他頻道聊天的頻道的名稱。 例如:我有一個頻道叫貓貓聊天; 我也有一個頻道Dog。 我已經使用 Dog 將消息發送到 Cat 聊天中,並且我想將名字 Dog 放入變量中。 我試過message.from_user.usernamemessage.from_user.first_name但它打印了 Channel_bot 和 Channel。 我的聊天中有其他頻道評論的例子

所以昵稱“gdfgd”應該保存在變量中。 有什么方法可以做到嗎? 我正在使用 python 和 aiogram。

https://core.telegram.org/bots/api#chat

我認為你需要一個關鍵的'message.chat.title'

我發現方法message.sender_chat.title打印出我想要的!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM