Files
Ultroid-fork/plugins/updater.py
Danish 68839e9dd0 Ultroid v0.0.7 2021/05/22
Co-authored-by: New-dev0 <New-dev0@notavailable.live>
Co-authored-by: Danish <danish@ultroid.tech>
Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com>
Co-authored-by: Programming Error <error@notavailable.live>
Co-authored-by: Aakash <BLUE-DEVIL1134@users.noreply.github.com>
Co-authored-by: Aditya <me@xditya.me>
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>
2021-05-22 22:21:41 +05:30

62 lines
1.8 KiB
Python

# Ultroid - UserBot
# Copyright (C) 2020 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 *
@ultroid_cmd(pattern="update$")
async def _(e):
m = await updater()
branch = (Repo.init()).active_branch
if m:
x = await ultroid_bot.asst.send_file(
int(udB.get("LOG_CHANNEL")),
"resources/extras/inline.jpg",
caption="• **Update Available** •",
force_document=False,
buttons=Button.inline("Changelogs", data="changes"),
)
Link = (await ultroid_bot(GetLink(x.peer_id.channel_id, x.id))).link
await eor(
e,
f'<strong><a href="{Link}">[ChangeLogs]</a></strong>',
parse_mode="html",
link_preview=False,
)
else:
await eor(
e,
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")),
"resources/extras/inline.jpg",
caption="• **Update Available** •",
force_document=False,
buttons=Button.inline("Changelogs", data="changes"),
)
HELP.update({f"{__name__.split('.')[1]}": f"{__doc__.format(i=HNDLR)}"})