1616# You should have received a copy of the GNU Lesser General Public License
1717# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
1818
19- from typing import Union
19+ from typing import Optional , Union
2020
2121import pyrogram
22- from pyrogram import raw
23- from pyrogram import types
22+ from pyrogram import raw , types
2423
2524
2625class GetSendAsChats :
2726 async def get_send_as_chats (
2827 self : "pyrogram.Client" ,
2928 chat_id : Union [int , str ],
29+ for_paid_reactions : Optional [bool ] = None
3030 ) -> list ["types.Chat" ]:
3131 """Get the list of "send_as" chats available.
3232
@@ -36,6 +36,9 @@ async def get_send_as_chats(
3636 chat_id (``int`` | ``str``):
3737 Unique identifier (int) or username (str) of the target chat.
3838
39+ for_paid_reactions (``bool``, *optional*):
40+ Pass True to get the list of available send_as chats for paid reactions.
41+
3942 Returns:
4043 List of :obj:`~pyrogram.types.Chat`: The list of chats.
4144
@@ -49,6 +52,7 @@ async def get_send_as_chats(
4952 r = await self .invoke (
5053 raw .functions .channels .GetSendAs (
5154 peer = await self .resolve_peer (chat_id ),
55+ for_paid_reactions = for_paid_reactions
5256 )
5357 )
5458
@@ -58,9 +62,10 @@ async def get_send_as_chats(
5862 send_as_chats = types .List ()
5963
6064 for p in r .peers :
61- if isinstance (p , raw .types .PeerUser ):
62- send_as_chats .append (types .Chat ._parse_chat (self , users [p .user_id ]))
65+ # TODO
66+ if isinstance (p .peer , raw .types .PeerUser ):
67+ send_as_chats .append (types .Chat ._parse_chat (self , users [p .peer .user_id ]))
6368 else :
64- send_as_chats .append (types .Chat ._parse_chat (self , chats [p .channel_id ]))
69+ send_as_chats .append (types .Chat ._parse_chat (self , chats [p .peer . channel_id ]))
6570
6671 return send_as_chats
0 commit comments