# Moon-Userbot - telegram userbot # Copyright (C) 2020-present Moon Userbot Organization # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . import datetime import random from pyrogram import Client, filters from pyrogram.types import Message from utils.misc import gitrepo, modules_help, prefix, python_version, userbot_version @Client.on_message(filters.command(['support', 'repo'], prefix) & filters.me) async def support(_, message: Message): devs = ['@Qbtaumai', '@H4T3H46K3R'] random.shuffle(devs) commands_count = 0.0 for module in modules_help: for _cmd in module: commands_count += 1 await message.edit( f'Moon-Userbot\n\n' 'GitHub: Moon-Userbot\n' 'Custom modules repository: ' 'custom_modules\n' 'License: GNU GPL v3\n\n' 'Channel: @moonuserbot\n' 'Custom modules: @moonub_modules\n' 'Chat [EN]: @moonub_chat\n' f'Main developers: {", ".join(devs)}\n\n' f'Python version: {python_version}\n' f'Modules count: {len(modules_help) / 1}\n' f'Commands count: {commands_count}', disable_web_page_preview=True, ) @Client.on_message(filters.command(['version', 'ver'], prefix) & filters.me) async def version(client: Client, message: Message): changelog = '' ub_version = '.'.join(userbot_version.split('.')[:2]) async for m in client.search_messages('moonuserbot', query=f'{userbot_version}.'): if ub_version in m.text: changelog = m.message_id await message.delete() if gitrepo is not None: remote_url = list(gitrepo.remote().urls)[0] commit_time = ( datetime.datetime.fromtimestamp(gitrepo.head.commit.committed_date) .astimezone(datetime.UTC) .strftime('%Y-%m-%d %H:%M:%S %Z') ) git_info = ( ( f'\nBranch: {gitrepo.active_branch}\n' if gitrepo.active_branch != 'master' else '\n' ) + f'Commit: ' f'{gitrepo.head.commit.hexsha[:7]} by {gitrepo.head.commit.author.name}\n' f'Commit time: {commit_time}' ) else: git_info = '' await message.reply( f'Moon Userbot version: {userbot_version}\n' f'Changelog in channel.\n' f'Changelog written by ' f'Abhi\n\n' f'{git_info}', ) modules_help['support'] = { 'support': 'Information about userbot', 'version': 'Check userbot version', }