Spaces:
Runtime error
Runtime error
Commit
·
ad0abde
1
Parent(s):
4932737
Update main.py
Browse files
main.py
CHANGED
@@ -7,6 +7,9 @@ from rubika.filters import filters
|
|
7 |
|
8 |
from text import text_t
|
9 |
|
|
|
|
|
|
|
10 |
|
11 |
bot = Bot(appName="bot", auth=os.environ.get("AUTH"))
|
12 |
soc = Socket(auth=os.environ.get("AUTH"))
|
@@ -16,7 +19,7 @@ admin_g = os.environ.get('ADMIN')
|
|
16 |
@soc.handler(filters.PV)
|
17 |
def handler(message):
|
18 |
try:
|
19 |
-
if message.data.object_guid == admin_g
|
20 |
mtext = message.data.message.text
|
21 |
if mtext[0:24] == 'https://rubika.ir/joing/':
|
22 |
bot.join(mtext)
|
@@ -24,11 +27,17 @@ def handler(message):
|
|
24 |
elif mtext == 'بنر':
|
25 |
try:
|
26 |
for i in bot.getChats()['data']['chats']:
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
30 |
message.reply("بنر ارسال شد")
|
31 |
except:
|
32 |
message.reply("بنر ارسال نشد")
|
33 |
except:
|
34 |
message.reply("بات به مشکل خورد")
|
|
|
|
|
|
7 |
|
8 |
from text import text_t
|
9 |
|
10 |
+
if platform.system() == 'Windows':
|
11 |
+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
12 |
+
|
13 |
|
14 |
bot = Bot(appName="bot", auth=os.environ.get("AUTH"))
|
15 |
soc = Socket(auth=os.environ.get("AUTH"))
|
|
|
19 |
@soc.handler(filters.PV)
|
20 |
def handler(message):
|
21 |
try:
|
22 |
+
if message.data.object_guid == admin_g:
|
23 |
mtext = message.data.message.text
|
24 |
if mtext[0:24] == 'https://rubika.ir/joing/':
|
25 |
bot.join(mtext)
|
|
|
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 |
+
pass
|
37 |
message.reply("بنر ارسال شد")
|
38 |
except:
|
39 |
message.reply("بنر ارسال نشد")
|
40 |
except:
|
41 |
message.reply("بات به مشکل خورد")
|
42 |
+
|
43 |
+
bot.sendMessage(admin_g, 'ربات روشن شد')
|