Ultroid v0.0.8 | 17-6-21
Co-authored-by: Aditya <me@xditya.me> Co-authored-by: Danish <danish@ultroid.tech> Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: sppidy <sppidy@users.noreply.github.com> Co-authored-by: Arnab Paryali <Arnabxd@users.noreply.github.com> Co-authored-by: divkix <divkix@users.noreply.github.com> Co-authored-by: hellboi_atul <hellboi-atul@users.noreply.github.com> Co-authored-by: Programming Error <error@notavailable.live> Co-authored-by: New-dev0 <New-dev0@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Ultroid - UserBot
|
||||
# Copyright (C) 2020 TeamUltroid
|
||||
# Copyright (C) 2021 TeamUltroid
|
||||
#
|
||||
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
||||
# PLease read the GNU Affero General Public License in
|
||||
@@ -10,19 +10,18 @@ import time
|
||||
from datetime import datetime
|
||||
from math import ceil
|
||||
from os import remove
|
||||
from platform import python_version as PyVer
|
||||
|
||||
from git import Repo
|
||||
from pyUltroid import __version__ as UltVer
|
||||
from pyUltroid.misc import owner_and_sudos
|
||||
from support import *
|
||||
from telethon import Button, __version__
|
||||
from telethon.tl.types import InputWebDocument
|
||||
from telethon.tl.types import InputBotInlineResult, InputWebDocument
|
||||
|
||||
from . import *
|
||||
|
||||
# ================================================#
|
||||
notmine = f"This bot is for {OWNER_NAME}"
|
||||
ULTROID_PIC = "https://telegra.ph/file/115f149ed8e154641708b.jpg"
|
||||
|
||||
TLINK = "https://telegra.ph/file/d9c9bc13647fa1d96e764.jpg"
|
||||
helps = get_string("inline_1")
|
||||
|
||||
add_ons = udB.get("ADDONS")
|
||||
@@ -30,49 +29,74 @@ if add_ons == "True" or add_ons is None:
|
||||
zhelps = get_string("inline_2")
|
||||
else:
|
||||
zhelps = get_string("inline_3")
|
||||
if udB.get("INLINE_PIC"):
|
||||
_file_to_replace = udB.get("INLINE_PIC")
|
||||
|
||||
C_PIC = udB.get("INLINE_PIC")
|
||||
|
||||
if C_PIC:
|
||||
_file_to_replace = C_PIC
|
||||
TLINK = C_PIC
|
||||
else:
|
||||
_file_to_replace = "resources/extras/inline.jpg"
|
||||
# ============================================#
|
||||
|
||||
|
||||
# --------------------BUTTONS--------------------#
|
||||
|
||||
_main_help_menu = [
|
||||
[
|
||||
Button.inline("• Pʟᴜɢɪɴs", data="hrrrr"),
|
||||
Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
|
||||
],
|
||||
[
|
||||
Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
|
||||
Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
|
||||
],
|
||||
[
|
||||
Button.url("⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{asst.me.username}?start=set"),
|
||||
],
|
||||
[Button.inline("••Cʟᴏꜱᴇ••", data="close")],
|
||||
]
|
||||
|
||||
SUP_BUTTONS = [
|
||||
[
|
||||
Button.url("Repo", url="https://github.com/TeamUltroid/Ultroid"),
|
||||
Button.url("Addons", url="https://github.com/TeamUltroid/UltroidAddons"),
|
||||
],
|
||||
[Button.url("Support", url="t.me/UltroidSupport")],
|
||||
]
|
||||
|
||||
# --------------------BUTTONS--------------------#
|
||||
|
||||
|
||||
@in_pattern("")
|
||||
@in_owner
|
||||
async def e(o):
|
||||
async def inline_alive(o):
|
||||
if len(o.text) == 0:
|
||||
b = o.builder
|
||||
MSG = "• **Ultroid Userbot •**"
|
||||
uptime = grt(time.time() - start_time)
|
||||
header = udB.get("ALIVE_TEXT") if udB.get("ALIVE_TEXT") else "Hey, I am alive."
|
||||
ALIVEMSG = get_string("alive_1").format(
|
||||
header,
|
||||
OWNER_NAME,
|
||||
ultroid_version,
|
||||
UltVer,
|
||||
uptime,
|
||||
PyVer(),
|
||||
__version__,
|
||||
Repo().active_branch,
|
||||
MSG += f"\n\n• **Uptime** - `{uptime}`\n"
|
||||
MSG += f"• **OWNER** - `{OWNER_NAME}`"
|
||||
WEB0 = InputWebDocument(
|
||||
"https://telegra.ph/file/55dd0f381c70e72557cb1.jpg", 0, "image/jpg", []
|
||||
)
|
||||
res = [
|
||||
await b.article(
|
||||
RES = [
|
||||
InputBotInlineResult(
|
||||
str(o.id),
|
||||
"photo",
|
||||
send_message=await b._message(
|
||||
text=MSG,
|
||||
media=True,
|
||||
buttons=SUP_BUTTONS,
|
||||
),
|
||||
title="Ultroid Userbot",
|
||||
url="https://t.me/TeamUltroid",
|
||||
description="Userbot | Telethon ",
|
||||
text=ALIVEMSG,
|
||||
thumb=InputWebDocument(ULTROID_PIC, 0, "image/jpeg", []),
|
||||
buttons=[
|
||||
[Button.url(text="Support Group", url="t.me/UltroidSupport")],
|
||||
[
|
||||
Button.url(
|
||||
text="Repo",
|
||||
url="https://github.com/Teamultroid/Ultroid",
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
description="Userbot | Telethon",
|
||||
url=TLINK,
|
||||
thumb=WEB0,
|
||||
content=InputWebDocument(TLINK, 0, "image/jpg", []),
|
||||
)
|
||||
]
|
||||
await o.answer(res, switch_pm=f"👥 ULTROID PORTAL", switch_pm_param="start")
|
||||
await o.answer(RES, switch_pm=f"👥 ULTROID PORTAL", switch_pm_param="start")
|
||||
|
||||
|
||||
@in_pattern("ultd")
|
||||
@@ -82,8 +106,6 @@ async def inline_handler(event):
|
||||
for x in LIST.values():
|
||||
for y in x:
|
||||
z.append(y)
|
||||
cmd = len(z)
|
||||
bnn = asst.me.username
|
||||
result = event.builder.photo(
|
||||
file=_file_to_replace,
|
||||
link_preview=False,
|
||||
@@ -91,24 +113,11 @@ async def inline_handler(event):
|
||||
OWNER_NAME,
|
||||
len(PLUGINS),
|
||||
len(ADDONS),
|
||||
cmd,
|
||||
len(z),
|
||||
),
|
||||
buttons=[
|
||||
[
|
||||
Button.inline("• Pʟᴜɢɪɴs", data="hrrrr"),
|
||||
Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
|
||||
],
|
||||
[
|
||||
Button.inline("Oᴡɴᴇʀ•ᴛᴏᴏʟꜱ", data="ownr"),
|
||||
Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
|
||||
],
|
||||
[
|
||||
Button.url("⚙️Sᴇᴛᴛɪɴɢs⚙️", url=f"https://t.me/{bnn}?start=set"),
|
||||
],
|
||||
[Button.inline("••Cʟᴏꜱᴇ••", data="close")],
|
||||
],
|
||||
buttons=_main_help_menu,
|
||||
)
|
||||
await event.answer([result])
|
||||
await event.answer([result], gallery=True)
|
||||
|
||||
|
||||
@in_pattern("paste")
|
||||
@@ -129,6 +138,24 @@ async def _(event):
|
||||
await event.answer([result])
|
||||
|
||||
|
||||
@in_pattern("dog")
|
||||
@in_owner
|
||||
async def _(event):
|
||||
ok = event.text.split(" ")[1]
|
||||
link = "https://del.dog/"
|
||||
result = event.builder.article(
|
||||
title="Paste",
|
||||
text="Pᴀsᴛᴇᴅ Tᴏ Dᴏɢʙɪɴ!",
|
||||
buttons=[
|
||||
[
|
||||
Button.url("DogBin", url=f"{link}{ok}"),
|
||||
Button.url("Raw", url=f"{link}raw/{ok}"),
|
||||
],
|
||||
],
|
||||
)
|
||||
await event.answer([result])
|
||||
|
||||
|
||||
@callback("ownr")
|
||||
@owner
|
||||
async def setting(event):
|
||||
@@ -202,8 +229,8 @@ async def _(event):
|
||||
async def _(event):
|
||||
start = datetime.now()
|
||||
end = datetime.now()
|
||||
ms = (end - start).microseconds / 1000
|
||||
pin = f"🌋Pɪɴɢ = {ms}ms"
|
||||
ms = (end - start).microseconds
|
||||
pin = f"🌋Pɪɴɢ = {ms} microseconds"
|
||||
await event.answer(pin, cache_time=0, alert=True)
|
||||
|
||||
|
||||
@@ -256,8 +283,8 @@ async def _(e):
|
||||
],
|
||||
[
|
||||
Button.switch_inline(
|
||||
"CʟɪᴘAʀᴛ Sᴇᴀʀᴄʜ",
|
||||
query="clipart frog",
|
||||
"EBᴏᴏᴋs Uᴘʟᴏᴀᴅᴇʀ",
|
||||
query="ebooks India",
|
||||
same_peer=True,
|
||||
),
|
||||
Button.switch_inline(
|
||||
@@ -384,37 +411,18 @@ async def backr(event):
|
||||
@callback("open")
|
||||
@owner
|
||||
async def opner(event):
|
||||
bnn = asst.me.username
|
||||
buttons = [
|
||||
[
|
||||
Button.inline("• Pʟᴜɢɪɴs ", data="hrrrr"),
|
||||
Button.inline("• Aᴅᴅᴏɴs", data="frrr"),
|
||||
],
|
||||
[
|
||||
Button.inline("Oᴡɴᴇʀ•Tᴏᴏʟꜱ", data="ownr"),
|
||||
Button.inline("Iɴʟɪɴᴇ•Pʟᴜɢɪɴs", data="inlone"),
|
||||
],
|
||||
[
|
||||
Button.url(
|
||||
"⚙️Sᴇᴛᴛɪɴɢs⚙️",
|
||||
url=f"https://t.me/{bnn}?start={ultroid_bot.me.id}",
|
||||
),
|
||||
],
|
||||
[Button.inline("••Cʟᴏꜱᴇ••", data="close")],
|
||||
]
|
||||
z = []
|
||||
for x in LIST.values():
|
||||
for y in x:
|
||||
z.append(y)
|
||||
cmd = len(z) + 10
|
||||
await event.edit(
|
||||
get_string("inline_4").format(
|
||||
OWNER_NAME,
|
||||
len(PLUGINS),
|
||||
len(ADDONS),
|
||||
cmd,
|
||||
len(z),
|
||||
),
|
||||
buttons=buttons,
|
||||
buttons=_main_help_menu,
|
||||
link_preview=False,
|
||||
)
|
||||
|
||||
@@ -425,7 +433,7 @@ async def on_plug_in_callback_query_handler(event):
|
||||
await event.edit(
|
||||
get_string("inline_5"),
|
||||
file=_file_to_replace,
|
||||
buttons=Button.inline("Oᴘᴇɴ Mᴀɪɴ Mᴇɴᴜ Aɢᴀɪɴ", data="open"),
|
||||
buttons=Button.inline("Oᴘᴇɴ Aɢᴀɪɴ", data="open"),
|
||||
)
|
||||
|
||||
|
||||
@@ -461,7 +469,7 @@ async def on_plug_in_callback_query_handler(event):
|
||||
],
|
||||
]
|
||||
try:
|
||||
if event.query.user_id in sed:
|
||||
if str(event.query.user_id) in owner_and_sudos():
|
||||
await event.edit(
|
||||
reply_pop_up_alert,
|
||||
buttons=buttons,
|
||||
@@ -520,7 +528,7 @@ async def on_plug_in_callback_query_handler(event):
|
||||
],
|
||||
]
|
||||
try:
|
||||
if event.query.user_id in sed:
|
||||
if str(event.query.user_id) in owner_and_sudos():
|
||||
await event.edit(
|
||||
reply_pop_up_alert,
|
||||
buttons=buttons,
|
||||
|
||||
Reference in New Issue
Block a user