-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Expand file tree
/
Copy path__init__.py
More file actions
131 lines (108 loc) · 3.47 KB
/
__init__.py
File metadata and controls
131 lines (108 loc) · 3.47 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# Ultroid - UserBot
# Copyright (C) 2021-2025 TeamUltroid
#
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
# PLease read the GNU Affero General Public License in
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
import asyncio
import os
import time
from random import choice
import requests
from telethon import Button, events
from telethon.tl import functions, types # pylint:ignore
from pyUltroid import *
from pyUltroid._misc._assistant import asst_cmd, callback, in_pattern
from pyUltroid._misc._decorators import ultroid_cmd
from telethon.tl.types import Message
from pyUltroid._misc._wrappers import eod, eor
from pyUltroid.dB import DEVLIST, ULTROID_IMAGES
from pyUltroid.fns.helper import *
from pyUltroid.fns.misc import *
from pyUltroid.fns.tools import *
from pyUltroid.database.base import BaseDatabase as Database
from pyUltroid.version import __version__, ultroid_version
from strings import get_help, get_string
from catbox import CatboxUploader
udB: Database
Redis = udB.get_key
con = TgConverter
quotly = Quotly()
OWNER_NAME = ultroid_bot.full_name
OWNER_ID = ultroid_bot.uid
ultroid_bot: UltroidClient
asst: UltroidClient
LOG_CHANNEL = udB.get_key("LOG_CHANNEL")
def inline_pic():
INLINE_PIC = udB.get_key("INLINE_PIC")
if INLINE_PIC is None:
INLINE_PIC = choice(ULTROID_IMAGES)
elif INLINE_PIC == False:
INLINE_PIC = None
return INLINE_PIC
Telegraph = telegraph_client()
cat_uploader = CatboxUploader()
upload_file = cat_uploader.upload_file
List = []
Dict = {}
InlinePlugin = {}
N = 0
cmd = ultroid_cmd
STUFF = {}
# Chats, which needs to be ignore for some cases
# Considerably, there can be many
# Feel Free to Add Any other...
NOSPAM_CHAT = [
-1001361294038, # UltroidSupportChat
-1001387666944, # PyrogramChat
-1001109500936, # TelethonChat
-1001050982793, # Python
-1001256902287, # DurovsChat
-1001473548283, # SharingUserbot
]
ATRA_COL = [
"DarkCyan",
"DeepSkyBlue",
"DarkTurquoise",
"Cyan",
"LightSkyBlue",
"Turquoise",
"MediumVioletRed",
"Aquamarine",
"Lightcyan",
"Azure",
"Moccasin",
"PowderBlue",
]
def deEmojify(inputString: str) -> str:
"""Remove emojis and other non-safe characters from string"""
EMOJI_PATTERN = re.compile(
"["
"\U0001F1E0-\U0001F1FF" # flags (iOS)
"\U0001F300-\U0001F5FF" # symbols & pictographs
"\U0001F600-\U0001F64F" # emoticons
"\U0001F680-\U0001F6FF" # transport & map symbols
"\U0001F700-\U0001F77F" # alchemical symbols
"\U0001F780-\U0001F7FF" # Geometric Shapes Extended
"\U0001F800-\U0001F8FF" # Supplemental Arrows-C
"\U0001F900-\U0001F9FF" # Supplemental Symbols and Pictographs
"\U0001FA00-\U0001FA6F" # Chess Symbols
"\U0001FA70-\U0001FAFF" # Symbols and Pictographs Extended-A
"\U00002702-\U000027B0" # Dingbats
"]+",)
return re.sub(EMOJI_PATTERN, "", inputString)
async def something(e, msg, media, button, reply=True, chat=None):
if e.client._bot:
return await e.reply(msg, file=media, buttons=button)
num = len(STUFF) + 1
STUFF.update({num: {"msg": msg, "media": media, "button": button}})
try:
res = await e.client.inline_query(asst.me.username, f"stf{num}")
return await res[0].click(
chat or e.chat_id,
reply_to=bool(isinstance(e, Message) and reply),
hide_via=True,
silent=True,
)
except Exception as er:
LOGS.exception(er)