Spaces:
Runtime error
Runtime error
Jishu Developer
commited on
Update helper_func.py
Browse files- helper_func.py +8 -9
helper_func.py
CHANGED
@@ -1,11 +1,3 @@
|
|
1 |
-
# Jishu Developer
|
2 |
-
# Don't Remove Credit 🥺
|
3 |
-
# Telegram Channel @Madflix_Bots
|
4 |
-
# Backup Channel @JishuBotz
|
5 |
-
# Developer @JishuDeveloper
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
import base64
|
10 |
import re
|
11 |
import asyncio
|
@@ -15,6 +7,9 @@ from config import FORCE_SUB_CHANNEL, ADMINS
|
|
15 |
from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant
|
16 |
from pyrogram.errors import FloodWait
|
17 |
|
|
|
|
|
|
|
18 |
async def is_subscribed(filter, client, update):
|
19 |
if not FORCE_SUB_CHANNEL:
|
20 |
return True
|
@@ -30,13 +25,15 @@ async def is_subscribed(filter, client, update):
|
|
30 |
return False
|
31 |
else:
|
32 |
return True
|
33 |
-
|
|
|
34 |
async def encode(string):
|
35 |
string_bytes = string.encode("ascii")
|
36 |
base64_bytes = base64.urlsafe_b64encode(string_bytes)
|
37 |
base64_string = (base64_bytes.decode("ascii")).strip("=")
|
38 |
return base64_string
|
39 |
|
|
|
40 |
async def decode(base64_string):
|
41 |
base64_string = base64_string.strip("=") # links generated before this commit will be having = sign, hence striping them to handle padding errors.
|
42 |
base64_bytes = (base64_string + "=" * (-len(base64_string) % 4)).encode("ascii")
|
@@ -44,6 +41,7 @@ async def decode(base64_string):
|
|
44 |
string = string_bytes.decode("ascii")
|
45 |
return string
|
46 |
|
|
|
47 |
async def get_messages(client, message_ids):
|
48 |
messages = []
|
49 |
total_messages = 0
|
@@ -66,6 +64,7 @@ async def get_messages(client, message_ids):
|
|
66 |
messages.extend(msgs)
|
67 |
return messages
|
68 |
|
|
|
69 |
async def get_message_id(client, message):
|
70 |
if message.forward_from_chat:
|
71 |
if message.forward_from_chat.id == client.db_channel.id:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import base64
|
2 |
import re
|
3 |
import asyncio
|
|
|
7 |
from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant
|
8 |
from pyrogram.errors import FloodWait
|
9 |
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
async def is_subscribed(filter, client, update):
|
14 |
if not FORCE_SUB_CHANNEL:
|
15 |
return True
|
|
|
25 |
return False
|
26 |
else:
|
27 |
return True
|
28 |
+
|
29 |
+
|
30 |
async def encode(string):
|
31 |
string_bytes = string.encode("ascii")
|
32 |
base64_bytes = base64.urlsafe_b64encode(string_bytes)
|
33 |
base64_string = (base64_bytes.decode("ascii")).strip("=")
|
34 |
return base64_string
|
35 |
|
36 |
+
|
37 |
async def decode(base64_string):
|
38 |
base64_string = base64_string.strip("=") # links generated before this commit will be having = sign, hence striping them to handle padding errors.
|
39 |
base64_bytes = (base64_string + "=" * (-len(base64_string) % 4)).encode("ascii")
|
|
|
41 |
string = string_bytes.decode("ascii")
|
42 |
return string
|
43 |
|
44 |
+
|
45 |
async def get_messages(client, message_ids):
|
46 |
messages = []
|
47 |
total_messages = 0
|
|
|
64 |
messages.extend(msgs)
|
65 |
return messages
|
66 |
|
67 |
+
|
68 |
async def get_message_id(client, message):
|
69 |
if message.forward_from_chat:
|
70 |
if message.forward_from_chat.id == client.db_channel.id:
|