Spaces:
Paused
Paused
Upload 2 files
Browse files- plugins/_help.py +30 -32
- plugins/bot.py +364 -0
plugins/_help.py
CHANGED
@@ -1,40 +1,38 @@
|
|
1 |
# Ultroid - UserBot
|
2 |
-
# Copyright (C) 2021-
|
3 |
#
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
8 |
-
import base64
|
9 |
-
import inspect
|
10 |
-
from datetime import datetime
|
11 |
-
from html import unescape
|
12 |
-
from random import choice
|
13 |
-
from re import compile as re_compile
|
14 |
-
|
15 |
-
from bs4 import BeautifulSoup as bs
|
16 |
-
from telethon import Button
|
17 |
-
from telethon.tl.alltlobjects import LAYER, tlobjects
|
18 |
-
from telethon.tl.types import DocumentAttributeAudio as Audio
|
19 |
-
from telethon.tl.types import InputWebDocument as wb
|
20 |
-
|
21 |
from telethon.errors.rpcerrorlist import (
|
22 |
BotInlineDisabledError,
|
23 |
BotMethodInvalidError,
|
24 |
BotResponseTimeoutError,
|
25 |
)
|
26 |
from telethon.tl.custom import Button
|
27 |
-
from assistant import *
|
28 |
-
from xteam.dB._core import HELP, LIST
|
29 |
-
from xteam.fns.tools import cmd_regex_replace
|
30 |
|
31 |
-
from . import
|
|
|
|
|
|
|
32 |
|
33 |
_main_help_menu = [
|
34 |
[
|
35 |
-
Button.inline("
|
|
|
36 |
],
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
]
|
39 |
|
40 |
|
@@ -48,28 +46,28 @@ async def _help(ult):
|
|
48 |
output = f"**Plugin** - `{plug}`\n"
|
49 |
for i in HELP["Official"][plug]:
|
50 |
output += i
|
51 |
-
output += "\n@
|
52 |
-
await ult.eor(
|
53 |
elif HELP.get("Addons") and plug in HELP["Addons"]:
|
54 |
output = f"**Plugin** - `{plug}`\n"
|
55 |
for i in HELP["Addons"][plug]:
|
56 |
output += i
|
57 |
-
output += "\n@
|
58 |
await ult.eor(output)
|
59 |
elif HELP.get("VCBot") and plug in HELP["VCBot"]:
|
60 |
output = f"**Plugin** - `{plug}`\n"
|
61 |
for i in HELP["VCBot"][plug]:
|
62 |
output += i
|
63 |
-
output += "\n@
|
64 |
-
await ult.eor(
|
65 |
else:
|
66 |
try:
|
67 |
x = get_string("help_11").format(plug)
|
68 |
for d in LIST[plug]:
|
69 |
-
x +=
|
70 |
x += "\n"
|
71 |
-
x += "\n@
|
72 |
-
await ult.eor(
|
73 |
except BaseException:
|
74 |
file = None
|
75 |
compare_strings = []
|
@@ -93,7 +91,7 @@ async def _help(ult):
|
|
93 |
if best_match:
|
94 |
text += f"\nDid you mean `{best_match}`?"
|
95 |
return await ult.eor(text)
|
96 |
-
output = f"Command {plug} found in plugin - {file}
|
97 |
if file in HELP["Official"]:
|
98 |
for i in HELP["Official"][file]:
|
99 |
output += i
|
@@ -103,14 +101,14 @@ async def _help(ult):
|
|
103 |
elif HELP.get("VCBot") and file in HELP["VCBot"]:
|
104 |
for i in HELP["VCBot"][file]:
|
105 |
output += i
|
106 |
-
output += "\n@
|
107 |
-
await ult.eor(
|
108 |
except BaseException as er:
|
109 |
LOGS.exception(er)
|
110 |
await ult.eor("Error 🤔 occured.")
|
111 |
else:
|
112 |
try:
|
113 |
-
results = await ult.client.inline_query(asst.me.username, "
|
114 |
except BotMethodInvalidError:
|
115 |
z = []
|
116 |
for x in LIST.values():
|
|
|
1 |
# Ultroid - UserBot
|
2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
3 |
#
|
4 |
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
# PLease read the GNU Affero General Public License in
|
6 |
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
from telethon.errors.rpcerrorlist import (
|
9 |
BotInlineDisabledError,
|
10 |
BotMethodInvalidError,
|
11 |
BotResponseTimeoutError,
|
12 |
)
|
13 |
from telethon.tl.custom import Button
|
|
|
|
|
|
|
14 |
|
15 |
+
from pyUltroid.dB._core import HELP, LIST
|
16 |
+
from pyUltroid.fns.tools import cmd_regex_replace
|
17 |
+
|
18 |
+
from . import HNDLR, LOGS, OWNER_NAME, asst, get_string, inline_pic, udB, ultroid_cmd
|
19 |
|
20 |
_main_help_menu = [
|
21 |
[
|
22 |
+
Button.inline(get_string("help_4"), data="uh_Official_"),
|
23 |
+
Button.inline(get_string("help_5"), data="uh_Addons_"),
|
24 |
],
|
25 |
+
[
|
26 |
+
Button.inline(get_string("help_6"), data="uh_VCBot_"),
|
27 |
+
Button.inline(get_string("help_7"), data="inlone"),
|
28 |
+
],
|
29 |
+
[
|
30 |
+
Button.inline(get_string("help_8"), data="ownr"),
|
31 |
+
Button.url(
|
32 |
+
get_string("help_9"), url=f"https://t.me/{asst.me.username}?start=set"
|
33 |
+
),
|
34 |
+
],
|
35 |
+
[Button.inline(get_string("help_10"), data="close")],
|
36 |
]
|
37 |
|
38 |
|
|
|
46 |
output = f"**Plugin** - `{plug}`\n"
|
47 |
for i in HELP["Official"][plug]:
|
48 |
output += i
|
49 |
+
output += "\n© @TeamUltroid"
|
50 |
+
await ult.eor(output)
|
51 |
elif HELP.get("Addons") and plug in HELP["Addons"]:
|
52 |
output = f"**Plugin** - `{plug}`\n"
|
53 |
for i in HELP["Addons"][plug]:
|
54 |
output += i
|
55 |
+
output += "\n© @TeamUltroid"
|
56 |
await ult.eor(output)
|
57 |
elif HELP.get("VCBot") and plug in HELP["VCBot"]:
|
58 |
output = f"**Plugin** - `{plug}`\n"
|
59 |
for i in HELP["VCBot"][plug]:
|
60 |
output += i
|
61 |
+
output += "\n© @TeamUltroid"
|
62 |
+
await ult.eor(output)
|
63 |
else:
|
64 |
try:
|
65 |
x = get_string("help_11").format(plug)
|
66 |
for d in LIST[plug]:
|
67 |
+
x += HNDLR + d
|
68 |
x += "\n"
|
69 |
+
x += "\n© @TeamUltroid"
|
70 |
+
await ult.eor(x)
|
71 |
except BaseException:
|
72 |
file = None
|
73 |
compare_strings = []
|
|
|
91 |
if best_match:
|
92 |
text += f"\nDid you mean `{best_match}`?"
|
93 |
return await ult.eor(text)
|
94 |
+
output = f"**Command** `{plug}` **found in plugin** - `{file}`\n"
|
95 |
if file in HELP["Official"]:
|
96 |
for i in HELP["Official"][file]:
|
97 |
output += i
|
|
|
101 |
elif HELP.get("VCBot") and file in HELP["VCBot"]:
|
102 |
for i in HELP["VCBot"][file]:
|
103 |
output += i
|
104 |
+
output += "\n© @TeamUltroid"
|
105 |
+
await ult.eor(output)
|
106 |
except BaseException as er:
|
107 |
LOGS.exception(er)
|
108 |
await ult.eor("Error 🤔 occured.")
|
109 |
else:
|
110 |
try:
|
111 |
+
results = await ult.client.inline_query(asst.me.username, "ultd")
|
112 |
except BotMethodInvalidError:
|
113 |
z = []
|
114 |
for x in LIST.values():
|
plugins/bot.py
ADDED
@@ -0,0 +1,364 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Ultroid - UserBot
|
2 |
+
# Copyright (C) 2021-2025 TeamUltroid
|
3 |
+
#
|
4 |
+
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
5 |
+
# PLease read the GNU Affero General Public License in
|
6 |
+
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
7 |
+
|
8 |
+
from . import get_help
|
9 |
+
|
10 |
+
__doc__ = get_help("help_bot")
|
11 |
+
|
12 |
+
import os
|
13 |
+
import sys
|
14 |
+
import time
|
15 |
+
from platform import python_version as pyver
|
16 |
+
from random import choice
|
17 |
+
|
18 |
+
from telethon import __version__
|
19 |
+
from telethon.errors.rpcerrorlist import (
|
20 |
+
BotMethodInvalidError,
|
21 |
+
ChatSendMediaForbiddenError,
|
22 |
+
)
|
23 |
+
|
24 |
+
from pyUltroid.version import __version__ as UltVer
|
25 |
+
|
26 |
+
from . import HOSTED_ON, LOGS
|
27 |
+
|
28 |
+
try:
|
29 |
+
from git import Repo
|
30 |
+
except ImportError:
|
31 |
+
LOGS.error("bot: 'gitpython' module not found!")
|
32 |
+
Repo = None
|
33 |
+
|
34 |
+
from telethon.utils import resolve_bot_file_id
|
35 |
+
|
36 |
+
from . import (
|
37 |
+
ATRA_COL,
|
38 |
+
LOGS,
|
39 |
+
OWNER_NAME,
|
40 |
+
ULTROID_IMAGES,
|
41 |
+
Button,
|
42 |
+
Carbon,
|
43 |
+
Telegraph,
|
44 |
+
Var,
|
45 |
+
allcmds,
|
46 |
+
asst,
|
47 |
+
bash,
|
48 |
+
call_back,
|
49 |
+
callback,
|
50 |
+
def_logs,
|
51 |
+
eor,
|
52 |
+
get_string,
|
53 |
+
heroku_logs,
|
54 |
+
in_pattern,
|
55 |
+
inline_pic,
|
56 |
+
restart,
|
57 |
+
shutdown,
|
58 |
+
start_time,
|
59 |
+
time_formatter,
|
60 |
+
udB,
|
61 |
+
ultroid_cmd,
|
62 |
+
ultroid_version,
|
63 |
+
updater,
|
64 |
+
)
|
65 |
+
|
66 |
+
|
67 |
+
def ULTPIC():
|
68 |
+
return inline_pic() or choice(ULTROID_IMAGES)
|
69 |
+
|
70 |
+
|
71 |
+
buttons = [
|
72 |
+
[
|
73 |
+
Button.url(get_string("bot_3"), "https://github.com/TeamUltroid/Ultroid"),
|
74 |
+
Button.url(get_string("bot_4"), "t.me/UltroidSupportChat"),
|
75 |
+
]
|
76 |
+
]
|
77 |
+
|
78 |
+
# Will move to strings
|
79 |
+
alive_txt = """
|
80 |
+
The Ultroid Userbot
|
81 |
+
|
82 |
+
◍ Version - {}
|
83 |
+
◍ Py-Ultroid - {}
|
84 |
+
◍ Telethon - {}
|
85 |
+
"""
|
86 |
+
|
87 |
+
in_alive = "{}\n\n🌀 <b>Ultroid Version -><b> <code>{}</code>\n🌀 <b>PyUltroid -></b> <code>{}</code>\n🌀 <b>Python -></b> <code>{}</code>\n🌀 <b>Uptime -></b> <code>{}</code>\n🌀 <b>Branch -></b>[ {} ]\n\n• <b>Join @TeamUltroid</b>"
|
88 |
+
|
89 |
+
|
90 |
+
@callback("alive")
|
91 |
+
async def alive(event):
|
92 |
+
text = alive_txt.format(ultroid_version, UltVer, __version__)
|
93 |
+
await event.answer(text, alert=True)
|
94 |
+
|
95 |
+
|
96 |
+
@ultroid_cmd(
|
97 |
+
pattern="alive( (.*)|$)",
|
98 |
+
)
|
99 |
+
async def lol(ult):
|
100 |
+
match = ult.pattern_match.group(1).strip()
|
101 |
+
inline = None
|
102 |
+
if match in ["inline", "i"]:
|
103 |
+
try:
|
104 |
+
res = await ult.client.inline_query(asst.me.username, "alive")
|
105 |
+
return await res[0].click(ult.chat_id)
|
106 |
+
except BotMethodInvalidError:
|
107 |
+
pass
|
108 |
+
except BaseException as er:
|
109 |
+
LOGS.exception(er)
|
110 |
+
inline = True
|
111 |
+
pic = udB.get_key("ALIVE_PIC")
|
112 |
+
if isinstance(pic, list):
|
113 |
+
pic = choice(pic)
|
114 |
+
uptime = time_formatter((time.time() - start_time) * 1000)
|
115 |
+
header = udB.get_key("ALIVE_TEXT") or get_string("bot_1")
|
116 |
+
y = Repo().active_branch
|
117 |
+
xx = Repo().remotes[0].config_reader.get("url")
|
118 |
+
rep = xx.replace(".git", f"/tree/{y}")
|
119 |
+
kk = f" `[{y}]({rep})` "
|
120 |
+
if inline:
|
121 |
+
kk = f"<a href={rep}>{y}</a>"
|
122 |
+
parse = "html"
|
123 |
+
als = in_alive.format(
|
124 |
+
header,
|
125 |
+
f"{ultroid_version} [{HOSTED_ON}]",
|
126 |
+
UltVer,
|
127 |
+
pyver(),
|
128 |
+
uptime,
|
129 |
+
kk,
|
130 |
+
)
|
131 |
+
|
132 |
+
if _e := udB.get_key("ALIVE_EMOJI"):
|
133 |
+
als = als.replace("🌀", _e)
|
134 |
+
else:
|
135 |
+
parse = "md"
|
136 |
+
als = (get_string("alive_1")).format(
|
137 |
+
header,
|
138 |
+
OWNER_NAME,
|
139 |
+
f"{ultroid_version} [{HOSTED_ON}]",
|
140 |
+
UltVer,
|
141 |
+
uptime,
|
142 |
+
pyver(),
|
143 |
+
__version__,
|
144 |
+
kk,
|
145 |
+
)
|
146 |
+
|
147 |
+
if a := udB.get_key("ALIVE_EMOJI"):
|
148 |
+
als = als.replace("✵", a)
|
149 |
+
if pic:
|
150 |
+
try:
|
151 |
+
await ult.reply(
|
152 |
+
als,
|
153 |
+
file=pic,
|
154 |
+
parse_mode=parse,
|
155 |
+
link_preview=False,
|
156 |
+
buttons=buttons if inline else None,
|
157 |
+
)
|
158 |
+
return await ult.try_delete()
|
159 |
+
except ChatSendMediaForbiddenError:
|
160 |
+
pass
|
161 |
+
except BaseException as er:
|
162 |
+
LOGS.exception(er)
|
163 |
+
try:
|
164 |
+
await ult.reply(file=pic)
|
165 |
+
await ult.reply(
|
166 |
+
als,
|
167 |
+
parse_mode=parse,
|
168 |
+
buttons=buttons if inline else None,
|
169 |
+
link_preview=False,
|
170 |
+
)
|
171 |
+
return await ult.try_delete()
|
172 |
+
except BaseException as er:
|
173 |
+
LOGS.exception(er)
|
174 |
+
await eor(
|
175 |
+
ult,
|
176 |
+
als,
|
177 |
+
parse_mode=parse,
|
178 |
+
link_preview=False,
|
179 |
+
buttons=buttons if inline else None,
|
180 |
+
)
|
181 |
+
|
182 |
+
|
183 |
+
@ultroid_cmd(pattern="ping$", chats=[], type=["official", "assistant"])
|
184 |
+
async def _(event):
|
185 |
+
start = time.time()
|
186 |
+
x = await event.eor("Pong !")
|
187 |
+
end = round((time.time() - start) * 1000)
|
188 |
+
uptime = time_formatter((time.time() - start_time) * 1000)
|
189 |
+
await x.edit(get_string("ping").format(end, uptime))
|
190 |
+
|
191 |
+
|
192 |
+
@ultroid_cmd(
|
193 |
+
pattern="cmds$",
|
194 |
+
)
|
195 |
+
async def cmds(event):
|
196 |
+
await allcmds(event, Telegraph)
|
197 |
+
|
198 |
+
|
199 |
+
heroku_api = Var.HEROKU_API
|
200 |
+
|
201 |
+
|
202 |
+
@ultroid_cmd(
|
203 |
+
pattern="restart$",
|
204 |
+
fullsudo=True,
|
205 |
+
)
|
206 |
+
async def restartbt(ult):
|
207 |
+
ok = await ult.eor(get_string("bot_5"))
|
208 |
+
call_back()
|
209 |
+
who = "bot" if ult.client._bot else "user"
|
210 |
+
udB.set_key("_RESTART", f"{who}_{ult.chat_id}_{ok.id}")
|
211 |
+
if heroku_api:
|
212 |
+
return await restart(ok)
|
213 |
+
await bash("git pull && pip3 install -r requirements.txt")
|
214 |
+
if len(sys.argv) > 1:
|
215 |
+
os.execl(sys.executable, sys.executable, "main.py")
|
216 |
+
else:
|
217 |
+
os.execl(sys.executable, sys.executable, "-m", "pyUltroid")
|
218 |
+
|
219 |
+
|
220 |
+
@ultroid_cmd(
|
221 |
+
pattern="shutdown$",
|
222 |
+
fullsudo=True,
|
223 |
+
)
|
224 |
+
async def shutdownbot(ult):
|
225 |
+
await shutdown(ult)
|
226 |
+
|
227 |
+
|
228 |
+
@ultroid_cmd(
|
229 |
+
pattern="logs( (.*)|$)",
|
230 |
+
chats=[],
|
231 |
+
)
|
232 |
+
async def _(event):
|
233 |
+
opt = event.pattern_match.group(1).strip()
|
234 |
+
file = f"ultroid{sys.argv[-1]}.log" if len(sys.argv) > 1 else "ultroid.log"
|
235 |
+
if opt == "heroku":
|
236 |
+
await heroku_logs(event)
|
237 |
+
elif opt == "carbon" and Carbon:
|
238 |
+
event = await event.eor(get_string("com_1"))
|
239 |
+
with open(file, "r") as f:
|
240 |
+
code = f.read()[-2500:]
|
241 |
+
file = await Carbon(
|
242 |
+
file_name="ultroid-logs",
|
243 |
+
code=code,
|
244 |
+
backgroundColor=choice(ATRA_COL),
|
245 |
+
)
|
246 |
+
if isinstance(file, dict):
|
247 |
+
await event.eor(f"`{file}`")
|
248 |
+
return
|
249 |
+
await event.reply("**Ultroid Logs.**", file=file)
|
250 |
+
elif opt == "open":
|
251 |
+
with open("ultroid.log", "r") as f:
|
252 |
+
file = f.read()[-4000:]
|
253 |
+
return await event.eor(f"`{file}`")
|
254 |
+
elif (
|
255 |
+
opt.isdigit() and 5 <= int(opt) <= 100
|
256 |
+
): # Check if input is a number between 10 and 100
|
257 |
+
num_lines = int(opt)
|
258 |
+
with open("ultroid.log", "r") as f:
|
259 |
+
lines = f.readlines()[-num_lines:]
|
260 |
+
file = "".join(lines)
|
261 |
+
return await event.eor(f"`{file}`")
|
262 |
+
else:
|
263 |
+
await def_logs(event, file)
|
264 |
+
await event.try_delete()
|
265 |
+
|
266 |
+
|
267 |
+
@in_pattern("alive", owner=True)
|
268 |
+
async def inline_alive(ult):
|
269 |
+
pic = udB.get_key("ALIVE_PIC")
|
270 |
+
if isinstance(pic, list):
|
271 |
+
pic = choice(pic)
|
272 |
+
uptime = time_formatter((time.time() - start_time) * 1000)
|
273 |
+
header = udB.get_key("ALIVE_TEXT") or get_string("bot_1")
|
274 |
+
y = Repo().active_branch
|
275 |
+
xx = Repo().remotes[0].config_reader.get("url")
|
276 |
+
rep = xx.replace(".git", f"/tree/{y}")
|
277 |
+
kk = f"<a href={rep}>{y}</a>"
|
278 |
+
als = in_alive.format(
|
279 |
+
header, f"{ultroid_version} [{HOSTED_ON}]", UltVer, pyver(), uptime, kk
|
280 |
+
)
|
281 |
+
|
282 |
+
if _e := udB.get_key("ALIVE_EMOJI"):
|
283 |
+
als = als.replace("🌀", _e)
|
284 |
+
builder = ult.builder
|
285 |
+
if pic:
|
286 |
+
try:
|
287 |
+
if ".jpg" in pic:
|
288 |
+
results = [
|
289 |
+
await builder.photo(
|
290 |
+
pic, text=als, parse_mode="html", buttons=buttons
|
291 |
+
)
|
292 |
+
]
|
293 |
+
else:
|
294 |
+
if _pic := resolve_bot_file_id(pic):
|
295 |
+
pic = _pic
|
296 |
+
buttons.insert(
|
297 |
+
0, [Button.inline(get_string("bot_2"), data="alive")]
|
298 |
+
)
|
299 |
+
results = [
|
300 |
+
await builder.document(
|
301 |
+
pic,
|
302 |
+
title="Inline Alive",
|
303 |
+
description="@TeamUltroid",
|
304 |
+
parse_mode="html",
|
305 |
+
buttons=buttons,
|
306 |
+
)
|
307 |
+
]
|
308 |
+
return await ult.answer(results)
|
309 |
+
except BaseException as er:
|
310 |
+
LOGS.exception(er)
|
311 |
+
result = [
|
312 |
+
await builder.article(
|
313 |
+
"Alive", text=als, parse_mode="html", link_preview=False, buttons=buttons
|
314 |
+
)
|
315 |
+
]
|
316 |
+
await ult.answer(result)
|
317 |
+
|
318 |
+
|
319 |
+
@ultroid_cmd(pattern="update( (.*)|$)")
|
320 |
+
async def _(e):
|
321 |
+
xx = await e.eor(get_string("upd_1"))
|
322 |
+
if e.pattern_match.group(1).strip() and (
|
323 |
+
"fast" in e.pattern_match.group(1).strip()
|
324 |
+
or "soft" in e.pattern_match.group(1).strip()
|
325 |
+
):
|
326 |
+
await bash("git pull -f && pip3 install -r requirements.txt")
|
327 |
+
call_back()
|
328 |
+
await xx.edit(get_string("upd_7"))
|
329 |
+
os.execl(sys.executable, "python3", "-m", "pyUltroid")
|
330 |
+
# return
|
331 |
+
m = await updater()
|
332 |
+
branch = (Repo.init()).active_branch
|
333 |
+
if m:
|
334 |
+
x = await asst.send_file(
|
335 |
+
udB.get_key("LOG_CHANNEL"),
|
336 |
+
ULTPIC(),
|
337 |
+
caption="• **Update Available** •",
|
338 |
+
force_document=False,
|
339 |
+
buttons=Button.inline("Changelogs", data="changes"),
|
340 |
+
)
|
341 |
+
Link = x.message_link
|
342 |
+
await xx.edit(
|
343 |
+
f'<strong><a href="{Link}">[ChangeLogs]</a></strong>',
|
344 |
+
parse_mode="html",
|
345 |
+
link_preview=False,
|
346 |
+
)
|
347 |
+
else:
|
348 |
+
await xx.edit(
|
349 |
+
f'<code>Your BOT is </code><strong>up-to-date</strong><code> with </code><strong><a href="https://github.com/TeamUltroid/Ultroid/tree/{branch}">[{branch}]</a></strong>',
|
350 |
+
parse_mode="html",
|
351 |
+
link_preview=False,
|
352 |
+
)
|
353 |
+
|
354 |
+
|
355 |
+
@callback("updtavail", owner=True)
|
356 |
+
async def updava(event):
|
357 |
+
await event.delete()
|
358 |
+
await asst.send_file(
|
359 |
+
udB.get_key("LOG_CHANNEL"),
|
360 |
+
ULTPIC(),
|
361 |
+
caption="• **Update Available** •",
|
362 |
+
force_document=False,
|
363 |
+
buttons=Button.inline("Changelogs", data="changes"),
|
364 |
+
)
|