File size: 1,805 Bytes
1d70768 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | from rubpy import Rubika
from re import findall
from time import sleep
import asyncio
bot = Rubika("ejsdcmpaibmctfmdsofnntsazrgxfqjp")
channel_guid : str = "c0Ee9X09008b057804dadf8f941e305a"
post_link: str = "https://rubika.ir/free__aep/DCAIDJJGICAABGB"
get_infos: list = []
links = []
async def main():
t: bool = False
while(t != True):
try:
message_info: str = await bot.getLinkFromAppUrl(post_link)
global get_infos
get_infos.append(message_info['message_id'])
get_infos.append(message_info['object_guid'])
t: bool = True
except:
t: bool = False
t: bool = False
while(t!=True):
try:
messages : list = await bot.getMessagesInterval(channel_guid, await bot.getChannelLastMessageId(channel_guid))
t:bool=True
except:
t:bool=False
for msg in messages:
try:
msg = msg['text']
group_link = findall(r"https://rubika.ir/joing/\w{32}", msg)
for link in group_link:
links.append(link)
except: pass
while(1):
for link in links:
t:bool=False
count:int=0
limit:int=5
while(count<5 and t!=True):
try:
group_guid:str= await bot.joinGroup(link)
group_guid: str = group_guid.get('data').get('group').get('group_guid')
t:bool=True
count += 5
except:
t:bool=False
count += 1
t:bool=False
count:int=0
limit:int=5
while(count<5 and t!=True):
try:
# await bot.sendMessage(group_guid, "تبلیغ")
await bot.forwardMessages(get_infos[1], [get_infos[0]], group_guid)
print('Sended!')
t:bool=True
count+=5
except:
t:bool=False
count+=1
t:bool=False
count:int=0
limit:int=5
while(count<5 and t!=True):
try:
await bot.leaveGroup(group_guid)
t:bool=True
count+=5
except:
t:bool=False
count+=1
asyncio.run(main()) |