async def help(client, message): args = get_arg(message) if not args: text = "**Available Commands**\n\n" for key, value in HELP.items(): text += f"{key}: {value}\n\n" await message.edit(text) return else: module_help = CMD_HELP.get(args, False) if not module_help: await message.edit("__Invalid module name specified.__") return else: await message.edit(module_help)
import time from pyrogram import filters from Zect import app, CMD_HELP from config import PREFIX, LOG_CHAT from Zect.helpers.pyrohelper import get_arg import Zect.database.afkdb as Zect from Zect.helpers.pyrohelper import user_afk from Zect.modules.alive import get_readable_time from Zect.helpers.utils import get_message_type, Types CMD_HELP.update( { "AFK": """ 『 **AFK** 』 `afk [reason]` -> Provides a message saying that you are unavailable. `unafk` -> Remove the AFK status. """ } ) LOG_CHAT = LOG_CHAT MENTIONED = [] AFK_RESTIRECT = {} DELAY_TIME = 60 @app.on_message(filters.command("afk", PREFIX) & filters.me) async def afk(client, message): afk_time = int(time.time())
from config import PREFIX import asyncio import time from datetime import datetime from pyrogram import filters from Zect import app, StartTime, CMD_HELP from sys import version_info from pyrogram import __version__ as __pyro_version__ from pyrogram.types import Message CMD_HELP.update({ "Alive": """ 『 **Alive** 』 `alive` -> Show off to people with your bot using this command. `ping` -> Shows you the response speed of the bot. """ }) __major__ = 0 __minor__ = 2 __micro__ = 1 __python_version__ = f"{version_info[0]}.{version_info[1]}.{version_info[2]}" def get_readable_time(seconds: int) -> str: count = 0 ping_time = "" time_list = []
import asyncio import aiohttp from pyrogram import filters from pyrogram.types import Message from Zect import app, CMD_HELP from config import PREFIX CMD_HELP.update( { "Misc": """ 『 **Misc** 』 `paste` -> Paste replied content to nekobin.com. `tr` [lang code] -> Transalte a text to a given language. `whois` [user handle] -> Provides information about the user. `id` [user handle] -> Give user or chat id """ } ) @app.on_message( filters.command(["neko", "nekobin", "bin", "paste"], PREFIX) & filters.me ) async def paste(_, message: Message): text = message.reply_to_message.text try: async with aiohttp.ClientSession() as session: async with session.post( "https://nekobin.com/api/documents", json={"content": text}, timeout=3 ) as response:
from pyrogram import filters import asyncio from pyrogram.methods import messages from Zect import app, CMD_HELP from Zect.helpers.pyrohelper import get_arg, denied_users import Zect.database.pmpermitdb as Zectdb from config import PREFIX CMD_HELP.update({ "Anti-PM": """ 『 **Anti-PM** 』 `pmguard` [on or off] -> Activates or deactivates anti-pm. `setpmmsg` [message or default] -> Sets a custom anti-pm message. `setblockmsg` [message or default] -> Sets custom block message. `setlimit` [value] -> This one sets a max. message limit for unwanted PMs and when they go beyond it, bamm!. `allow` -> Allows a user to PM you. `deny` -> Denies a user to PM you. """ }) FLOOD_CTRL = 0 ALLOWED = [] USERS_AND_WARNS = {} @app.on_message(filters.command("pmguard", PREFIX) & filters.me) async def pmguard(client, message): arg = get_arg(message) if not arg:
from Zect import app, CMD_HELP from Zect.helpers.pyrohelper import get_arg, get_args from Zect.helpers.adminhelpers import CheckAdmin from config import PREFIX CMD_HELP.update({ "Admin Tools": """ 『 **Admin Tools** 』 `ban` -> Bans user indefinitely. `unban` -> Unbans the user. `promote` [optional title] -> Promotes a user. `demote` _> Demotes a user. `mute` -> Mutes user indefinitely. `unmute` -> Unmutes the user. `kick` -> Kicks the user out of the group. `gmute` -> Doesn't lets a user speak(even admins). `ungmute` -> Inverse of what gmute does. `pin` -> pins a message. `del` -> delete a message. `purge` -> purge message(s) `invite` -> add user to chat. """ }) @app.on_message(filters.command("ban", PREFIX) & filters.me) async def ban_hammer(_, message: Message): if await CheckAdmin(message) is True: reply = message.reply_to_message
from pyrogram import filters from Zect import app, CMD_HELP from Zect.helpers.pyrohelper import get_arg import Zect.database.notesdb as Zect from config import PREFIX, LOG_CHAT CMD_HELP.update({ "Notes": """ 『 **Notes** 』 `save` -> Save a new note. Must be used in reply with one parameter (note name). `get` -> Gets the note specified. `clear` -> Deletes a note, specified by note name. `clearall` -> Deletes all the saved notes. `notes` -> List the saved notes. """ }) LOG_CHAT = LOG_CHAT @app.on_message(filters.command("save", PREFIX) & filters.me) async def save(client, message): arg = get_arg(message) if not arg: await message.edit("**You must give a name for a note.**") return note_name = arg note = await Zect.get_note(note_name) if note:
from config import PREFIX import traceback import sys import os import re import subprocess from io import StringIO from Zect import app, CMD_HELP from pyrogram import filters CMD_HELP.update({ "Developer": """ 『 **Developer** 』 `eval` -> A nice tool to test python codes. `term` -> Run commands in shell. """ }) async def aexec(code, client, message): exec(f"async def __aexec(client, message): " + "".join(f"\n {l}" for l in code.split("\n"))) return await locals()["__aexec"](client, message) @app.on_message(filters.command("eval", PREFIX) & filters.me) async def evaluate(client, message): status_message = await message.edit("`Running ...`") try: cmd = message.text.split(" ", maxsplit=1)[1]
from Zect import app, CMD_HELP from config import PREFIX, LOG_CHAT from Zect.helpers.pyrohelper import get_arg from Zect.database.filtersdb import ( add_filters, all_filters, del_filters, filters_del, filters_info, ) CMD_HELP.update({ "Filters": """ 『 **Filters** 』 `filters` -> List all active filters in current chat. `filter [keyword]` -> Saves a filter. `stop [keyword]` -> Stops a filter. `stopall` -> Removes all the filters in the chat. """ }) @app.on_message(filters.command("stop", PREFIX) & filters.me) async def del_filterz(client, message): note_ = await message.edit("**Processing..**") note_name = get_arg(message) if not note_name: await note_.edit("**Give A Filter Name!**") return note_name = note_name.lower() if not await filters_info(note_name, int(message.chat.id)):
# All rights reserved. import re from pyrogram import filters from Zect import app, CMD_HELP from Zect.helpers.pyrohelper import get_arg, welcome_chat import Zect.database.welcomedb as Zectdb from config import PREFIX, LOG_CHAT CMD_HELP.update( { "Greetings": """ 『 **Greetings** 』 `setwelcome` -> Sets a custom welcome message. `clearwelcome` -> Disables welcome message in the chat. """ } ) LOG_CHAT = LOG_CHAT @app.on_message(filters.command("clearwelcome", PREFIX) & filters.me) async def welcome(client, message): await Zectdb.clear_welcome(str(message.chat.id)) await message.edit("**I am sulking not to say hello anymore :(**") @app.on_message(filters.create(welcome_chat) & filters.new_chat_members, group=-2)
import random import time from PIL import Image from pyrogram import emoji, filters from pyrogram.raw.functions.messages import GetStickerSet from pyrogram.raw.types import InputStickerSetShortName from pyrogram.errors import YouBlockedUser, StickersetInvalid from Zect.helpers.pyrohelper import get_args from Zect import app, CMD_HELP from config import PREFIX CMD_HELP.update({ "Sticker": """ 『 **Sticker** 』 `kang` -> kangs stickers or creates new ones". `stkrinfo` -> Get sticker pack info. """ }) @app.on_message(filters.command("kang", PREFIX) & filters.me) async def kang(client, message): user = await app.get_me() replied = message.reply_to_message photo = None emoji_ = None is_anim = False resize = False if replied and replied.media: if replied.photo:
import asyncio import sys from os import environ, execle, path, remove from config import HEROKU_API, HEROKU_APP_NAME, PREFIX from git import Repo from git.exc import GitCommandError, InvalidGitRepositoryError, NoSuchPathError from pyrogram import filters from Zect import app, CMD_HELP from Zect.helpers.pyrohelper import get_arg CMD_HELP.update({ "Updater": """ 『 **Updater**』 `update`-> updates the userbot to latest build. """ }) UPSTREAM_REPO_URL = "https://github.com/okay-retard/ZectUserBot" requirements_path = path.join( path.dirname(path.dirname(path.dirname(__file__))), "requirements.txt") async def gen_chlog(repo, diff): ch_log = "" d_form = "On %d/%m/%y at %H:%M:%S" for c in repo.iter_commits(diff): ch_log += f"**#{c.count()}** : {c.committed_datetime.strftime(d_form)} : [{c.summary}]({UPSTREAM_REPO_URL.rstrip('/')}/commit/{c}) by `{c.author}`\n" return ch_log