File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 11import base64
2+ import asyncio
23from pyrogram import filters
3- from config import FORCE_SUB_CHANNEL , ADMINS
4+ from config import FORCE_SUB_CHANNEL , ADMINS , CHANNEL_ID
45from pyrogram .errors .exceptions .bad_request_400 import UserNotParticipant
6+ from pyrogram .errors import FloodWait
57
68async def is_subscribed (filter , client , message ):
79 if not FORCE_SUB_CHANNEL :
@@ -31,4 +33,26 @@ async def decode(base64_string):
3133 string = string_bytes .decode ("ascii" )
3234 return string
3335
36+ async def get_messages (client , message_ids ):
37+ messages = []
38+ total_messages = 0
39+ while total_messages != len (message_ids ):
40+ temb_ids = message_ids [total_messages :total_messages + 200 ]
41+ try :
42+ msgs = await client .get_messages (
43+ chat_id = CHANNEL_ID ,
44+ message_ids = temb_ids
45+ )
46+ except FloodWait as e :
47+ await asyncio .sleep (e .x )
48+ msgs = await client .get_messages (
49+ chat_id = CHANNEL_ID ,
50+ message_ids = temb_ids
51+ )
52+ except :
53+ pass
54+ total_messages += len (temb_ids )
55+ messages .extend (msgs )
56+ return messages
57+
3458subscribed = filters .create (is_subscribed )
You can’t perform that action at this time.
0 commit comments