Files
Ultroid-fork/plugins/updater.py
Anonymous 4e65f218f5 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>
2021-06-17 21:18:55 +05:30

63 lines
1.8 KiB
Python

# Ultroid - UserBot
# Copyright (C) 2021 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/>.
"""
✘ Commands Available -
• `{i}update`
See changelogs if any update is available.
"""
from git import Repo
from telethon.tl.functions.channels import ExportMessageLinkRequest as GetLink
from . import *
ULTPIC = "resources/extras/inline.jpg"
CL = udB.get("INLINE_PIC")
if CL:
ULTPIC = CL
@ultroid_cmd(pattern="update$")
async def _(e):
xx = await eor(e, "`Checking for updates...`")
m = await updater()
branch = (Repo.init()).active_branch
if m:
x = await ultroid_bot.asst.send_file(
int(udB.get("LOG_CHANNEL")),
ULTPIC,
caption="• **Update Available** •",
force_document=False,
buttons=Button.inline("Changelogs", data="changes"),
)
Link = (await ultroid_bot(GetLink(x.chat_id, x.id))).link
await xx.edit(
f'<strong><a href="{Link}">[ChangeLogs]</a></strong>',
parse_mode="html",
link_preview=False,
)
else:
await xx.edit(
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>',
parse_mode="html",
link_preview=False,
)
@callback("updtavail")
@owner
async def updava(event):
await event.delete()
await ultroid_bot.asst.send_file(
int(udB.get("LOG_CHANNEL")),
ULTPIC,
caption="• **Update Available** •",
force_document=False,
buttons=Button.inline("Changelogs", data="changes"),
)