from pyrogram import Filters from userbyte import byte, cmd, set_help from userbyte.helpers.admin import can_ban set_help( 'ban', '😈 **Ban Group Members \n\n👉 Command** : `.ban (id | username)`') @byte.on_message(Filters.command('ban', cmd) & Filters.me) async def ban_user(byte, message): chat_id = message.chat.id banned_msg = "**😈 New Ban 😈**\n" grp_info = await byte.get_chat(chat_id) admin_info = message.from_user if not await can_ban(message): await message.edit( "`🥵 Sorry you don't have enough rights to ban someone`") else: if message.reply_to_message: user_id = message.reply_to_message.from_user.id else: user_id = message.text[5:] if not user_id: await message.edit("`📌 No Valid User ID or Message Specified`") else: info = await byte.get_chat_member(chat_id, user_id) await byte.kick_chat_member(chat_id, user_id)
import pyrogram, os, requests, heroku3 from pyrogram import Filters from userbyte import byte, cmd, set_help from userbyte.config import HEROKU_APP_NAME, HEROKU_API_KEY set_help('logs', '😊 **Get Userbyte Logs \n\n👉 Command :** `.logs`') @byte.on_message(Filters.command('logs', cmd) & Filters.me) async def looogs(byte, message): await message.edit('`🤟 Fetching Logs.....`') heroku = heroku3.from_key(HEROKU_API_KEY) app = heroku.app(HEROKU_APP_NAME) data = app.get_log() with open('userbyte_logs.txt', 'w') as log: log.write(data) key = requests.post('https://nekobin.com/api/documents', json={ "content": data }).json().get('result').get('key') url = f'https://nekobin.com/{key}' await byte.send_document( chat_id=message.chat.id, document='userbyte_logs.txt', caption= f'😁 Here is Your Logs File\n [Click Here]({url}) to View on Nekobin' ) await message.delete() os.remove('userbyte_logs.txt')
# Copyright (C) 2020 by Team Devcode(Ayan Ansari, Adnan Ahmad) < https://github.com/DevcodeOfficial >. # # This file is part of project < https://github.com/DevcodeOfficial/UserByte > # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/DevcodeOfficial/UserByte/blob/master/LICENSE > # # All rights reserved. from userbyte import byte, cmd, set_help from pyrogram import Filters, Message set_help('alive', '😝 **This plugin is just for fun\n\n👉 Command :** `.alive`') ALIVE = """░█─░█ █▀▀ █── █── █▀▀█ ░█▀▀█ █▀▀ █── █── █──█ ░█─░█ ▀▀▀ ▀▀▀ ▀▀▀ ▀▀▀▀""" @byte.on_message(Filters.command("alive", cmd) & Filters.me) async def _alive(byte, message): await message.edit(ALIVE)
# This file is part of project < https://github.com/DevcodeOfficial/UserByte > # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/DevcodeOfficial/UserByte/blob/master/LICENSE > # # All rights reserved. import pyrogram, time, os from pyrogram import Client, Filters from pyrogram.api import functions from userbyte import byte, cmd, set_help from userbyte.helpers.loader import progress_for_pyrogram timesleep = 1 from datetime import datetime thumb_image_path = "./DOWNLOADS/thumb.jpg" set_help('upload', '⬆️ **Upload Files From Server\n\n👉 Command :** `.upload (file path | url)`\n\n👉 **Example :** `.upload ./DOWNLOADS/test.mp4`\n\n👉 **Example2 :** `.upload https://speed.hetzner.de/100MB.bin`') @byte.on_message(Filters.command(["upload"], cmd) & Filters.me) async def telegram_upload(client, message): msg = await message.edit("Processing ...") fname = message.text[8:] print(fname) thumb = None if os.path.exists(thumb_image_path): thumb = thumb_image_path if os.path.exists(fname): start = datetime.now() c_time = time.time() await message.reply_document( document=fname, quote=True,
# Copyright (C) 2020 by Team Devcode(Ayan Ansari, Adnan Ahmad) < https://github.com/DevcodeOfficial >. # # This file is part of project < https://github.com/DevcodeOfficial/UserByte > # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/DevcodeOfficial/UserByte/blob/master/LICENSE > # # All rights reserved. import pyrogram from pyrogram import Filters from userbyte import byte, cmd, set_help from datetime import datetime set_help('ping', '📲 **Check ping of your UserByte\n\n👉 Command :** `.ping`') @byte.on_message(Filters.command('ping', cmd) & Filters.me) async def piiing(byte, message): start = datetime.now() await message.edit("Pong!") end = datetime.now() ms = (end - start).microseconds / 1000 await message.edit("Pong!\n{} ms".format(ms))
# All rights reserved. # ♥️ to Hasibul Kobir import inspect import traceback import asyncio import sys import io import pyrogram from pyrogram import Filters, Client from userbyte.helpers.deldog import haste, paste from userbyte import byte, cmd, set_help set_help( 'eval', '💻 **Run Python Code\n\n👉 Command :** `.eval [your code]`\n\n**👉Example :** `.eval await byte.send_poll(message.chat.id, "Userbyte is best ?", ["Yes", "No"])`' ) @byte.on_message(Filters.command(["eval"], cmd) & Filters.me) async def ev_al(client, message): cmd = message.text.split(" ", maxsplit=1)[1] reply_to_id = message.message_id if message.reply_to_message: reply_to_id = message.reply_to_message.message_id old_stderr = sys.stderr old_stdout = sys.stdout redirected_output = sys.stdout = io.StringIO() redirected_error = sys.stderr = io.StringIO() stdout, stderr, exc = None, None, None
# # This file is part of project < https://github.com/DevcodeOfficial/UserByte > # and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/DevcodeOfficial/UserByte/blob/master/LICENSE > # # All rights reserved. import pyrogram, time, os, aiohttp, asyncio, math, time from pySmartDL import SmartDL from pyrogram import Client, Filters from datetime import datetime DOWNLOAD_LOCATION= "./DOWNLOADS/" from userbyte import byte, cmd, set_help from userbyte.helpers.loader import progress_for_pyrogram, humanbytes set_help('download', '⬇️ **Download Files To Server\n👉 Command :** `.download (url | reply to telegram media)`\n\n👉 **Example :** `.download https://speed.hetzner.de/100MB.bin`') @byte.on_message(Filters.command(["download"], cmd) & Filters.me) async def download_telegram(client, message): mone = await message.edit("Processing ...") # Reply url = message.text[10:] file_name = message.text[10:] DOWNLOAD_LOCATION= "./DOWNLOADS/" if message.reply_to_message: start = datetime.now() c_time = time.time() if file_name != "": DOWNLOAD_LOCATION = DOWNLOAD_LOCATION+file_name try: downloaded_file_name = await message.reply_to_message.download( file_name=DOWNLOAD_LOCATION,
# Please see < https://github.com/DevcodeOfficial/UserByte/blob/master/LICENSE > # # All rights reserved. # ♥️ to Hasibul Kobir import pyrogram from pyrogram import Filters, Client import io import asyncio import time import subprocess from userbyte.helpers.deldog import haste from userbyte import byte, cmd, set_help set_help('exec', '💻 **Run Shell Commands \n\n👉 Command :** `.exec [shell cmds]`\n\n👉 **Example :** `.exec echo UserByte Is Best `') @byte.on_message(Filters.command(["exec"], cmd) & Filters.me) async def ex_ec(client, message): DELAY_BETWEEN_EDITS = 0.5 PROCESS_RUN_TIME = 100 cmd = message.text.split(" ", maxsplit=1)[1] reply_to_id = message.message_id if message.reply_to_message: reply_to_id = message.reply_to_message.message_id start_time = time.time() + PROCESS_RUN_TIME process = await asyncio.create_subprocess_shell( cmd, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE ) stdout, stderr = await process.communicate() e = stderr.decode()