Team Ai
Apppublic

Hamedmirli/Python

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
main.py43 linesDownload Raw Back to root
1import asyncio2import os3import platform4 5from rubika import Bot, Socket6from rubika.filters import filters7 8from text import text_t9 10if platform.system() == 'Windows':11    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())12 13 14bot = Bot(appName="bot", auth=os.environ.get("AUTH"))15soc = Socket(auth=os.environ.get("AUTH"))16 17 18admin_g = os.environ.get('ADMIN')19@soc.handler(filters.PV)20def handler(message):21    try:22        if message.data.object_guid == admin_g:23            mtext = message.data.message.text24            if mtext[0:24] == 'https://rubika.ir/joing/':25                bot.join(mtext)26                message.reply("ربات عضو شد")27            elif mtext == 'بنر':28                try:29                    for i in bot.getChats()['data']['chats']:30                        try:31                            if i['abs_object']['type'] == 'Group':32                                gp = i['object_guid']33                                bot.sendPhoto(34                                    gp, "./img.jpg", [720, 720], caption=text_t, thumbnail='./img.jpg')35                        except:36                            pass37                    message.reply("بنر ارسال شد")38                except:39                    message.reply("بنر ارسال نشد")40    except:41        message.reply("بات به مشکل خورد")42 43bot.sendMessage(admin_g, 'ربات روشن شد')