"""Evaluate Python Code inside Telegram Syntax: .eval PythonCode""" # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from telethon import events, errors, functions, types import inspect import traceback import asyncio import sys import io from uniborg.util import mellow_cmd @borg.on(mellow_cmd("eval")) async def _(event): if event.fwd_from: return await event.edit("Processing ...") cmd = event.text.split(" ", maxsplit=1)[1] reply_to_id = event.message.id if event.reply_to_msg_id: reply_to_id = event.reply_to_msg_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
"""BarCode Generator Command .barcode (your text) By @snappy101 """ import asyncio import barcode import os import time from barcode.writer import ImageWriter from datetime import datetime from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="barcode ?(.*)")) async def _(event): if event.fwd_from: return await event.edit("...") start = datetime.now() input_str = event.pattern_match.group(1) message = "SYNTAX: `.barcode <long text to include>`" reply_msg_id = event.message.id if input_str: message = input_str elif event.reply_to_msg_id: previous_message = await event.get_reply_message() reply_msg_id = previous_message.id if previous_message.media: downloaded_file_name = await borg.download_media( previous_message,
#keep credit if u gonna edit or kang it #without creadit copy paster mc #creadits to sawan(@veryhelpful) learned from kraken import random, re from uniborg.util import mellow_cmd import asyncio from telethon import events @borg.on(mellow_cmd(pattern="mst ?(.*)")) async def _(event): if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"): await event.edit("mst hu bbro ") await asyncio.sleep(1) await event.edit("╔═╦═╗╔══╗╔══╗\n║║║║║║══╣╚╗╔╝\n║║║║║╠══║─║║─\n╚╩═╩╝╚══╝─╚╝─") @borg.on(mellow_cmd(pattern="gm ?(.*)")) async def _(event): if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"): await event.edit("good morning ") await asyncio.sleep(1) await event.edit("╔══╗╔═╦═╗\n║╔═╣║║║║║\n║╚╗║║║║║║\n╚══╝╚╩═╩╝") @borg.on(mellow_cmd(pattern="good ?(.*)")) async def _(event): if not event.text[0].isalpha() and event.text[0] not in ("/", "#", "@", "!"): await event.edit("╔══╗╔═╗╔═╗╔══╗\n║╔═╣║║║║║║╚╗╗║\n║╚╗║║║║║║║╔╩╝║\n╚══╝╚═╝╚═╝╚══╝") @borg.on(mellow_cmd(pattern="hhlo ?(.*)")) async def _(event):
import bs4 import requests import asyncio import os import re import subprocess import time from datetime import datetime from uniborg.util import mellow_cmd langi = "en" #kanged from Blank-x ;---; @borg.on(mellow_cmd("imdb (.*)", outgoing=True)) async def imdb(e): try: movie_name = e.pattern_match.group(1) remove_space = movie_name.split(' ') final_name = '+'.join(remove_space) page = requests.get("https://www.imdb.com/find?ref_=nv_sr_fn&q=" + final_name + "&s=all") lnk = str(page.status_code) soup = bs4.BeautifulSoup(page.content, 'lxml') odds = soup.findAll("tr", "odd") mov_title = odds[0].findNext('td').findNext('td').text mov_link = "http://www.imdb.com/" + odds[0].findNext('td').findNext( 'td').a['href'] page1 = requests.get(mov_link) soup = bs4.BeautifulSoup(page1.content, 'lxml')
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. from telethon import events from datetime import datetime import requests from uniborg.util import mellow_cmd @borg.on(mellow_cmd("xtools (.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) start = datetime.now() if event.reply_to_msg_id: previous_message = await event.get_reply_message() username = previous_message.message sub_domain = input_str else: sub_domain, username = input_str.split("|") final_url = "https://xtools.wmflabs.org/api/user/simple_editcount/{}.wikipedia.org/{}".format( sub_domain, username) json_string = requests.get(final_url).json() result_text = json_string["liveEditCount"] end = datetime.now() ms = (end - start).seconds output_str = "edit count of {} ({}) in {} seconds. \n {}".format( username, sub_domain, str(ms), result_text) await event.edit(output_str)
"""Emoji Available Commands: .isro built by @r4v4n4 , isse bhi loot lo betichod""" from telethon import events import asyncio from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern=r"fdance")) async def _(event): if event.fwd_from: return animation_interval = 1 animation_ttl = range(0, 5) #input_str = event.pattern_match.group(1) # if input_str == "isro": await event.edit("Connecting..")
"""Emoji Available Commands: .mtn""" from telethon import events import asyncio from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern=r"mtn")) async def _(event): if event.fwd_from: return animation_interval = 1 animation_ttl = range(0, 19) # input_str = event.pattern_match.group(1) # if input_str == "mtn": await event.edit("mtn") animation_chars = [ "`Connecting To MTN NG ....`", "`█ ▇ ▆ ▅ ▄ ▂ ▁`", "`▒ ▇ ▆ ▅ ▄ ▂ ▁`", "`▒ ▒ ▆ ▅ ▄ ▂ ▁`", "`▒ ▒ ▒ ▅ ▄ ▂ ▁`", "`▒ ▒ ▒ ▒ ▄ ▂ ▁`",
""" @ukinti_bot Available Commands: .unbanall .kick option Available Options: d, y, m, w, o, q, r """ from telethon import events from datetime import datetime, timedelta from telethon.tl.types import UserStatusEmpty, UserStatusLastMonth, UserStatusLastWeek, UserStatusOffline, UserStatusOnline, UserStatusRecently, ChannelParticipantsKicked, ChatBannedRights from telethon.tl import functions, types from time import sleep import asyncio from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="unbanall ?(.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) if input_str: logger.info("TODO: Not yet Implemented") else: if event.is_private: return False await event.edit("Searching Participant Lists.") p = 0 async for i in borg.iter_participants(event.chat_id, filter=ChannelParticipantsKicked, aggressive=True): rights = ChatBannedRights(until_date=0, view_messages=False) try:
"""Auto Profile Updation Commands .autoname""" from telethon import events import asyncio import time from telethon.tl import functions from telethon.errors import FloodWaitError from uniborg.util import mellow_cmd from userbot import ALIVE_NAME DEL_TIME_OUT = 60 DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "FRIDAY" @borg.on(mellow_cmd(pattern="autoname")) # pylint:disable=E0602 async def _(event): if event.fwd_from: return while True: DMY = time.strftime("%d.%m.%Y") HM = time.strftime("%H:%M:%S") name = f"⌚{HM} 🔥{DEFAULTUSER}🔥 📅{DMY}" logger.info(name) try: await borg( functions.account.UpdateProfileRequest( # pylint:disable=E0602 first_name=name)) except FloodWaitError as ex: logger.warning(str(e)) await asyncio.sleep(ex.seconds)
import re import bs4 import requests from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="giz ?(.*)")) async def gizoogle(event): if event.fwd_from: return input_str = event.pattern_match.group(1) await event.edit("Processing...") if not input_str: return await event.edit("I can't gizoogle nothing.") else: try: result = text(input_str) except: result = "Failed to gizoogle the text." finally: return await event.edit(result) def text(input_text: str) -> str: """Taken from https://github.com/chafla/gizoogle-py/blob/master/gizoogle.py""" params = {"translatetext": input_text} target_url = "http://www.gizoogle.net/textilizer.php" resp = requests.post(target_url, data=params) # the html returned is in poor form normally. soup_input = re.sub("/name=translatetext[^>]*>/", 'name="translatetext" >', resp.text)
""" Files Batch Uploader Plugin for userbot. usage:- .upb Note:- set TEMP_DIR in Your ENV Vars First. By:-@Zero_cool7870 """ import os import asyncio from uniborg.util import mellow_cmd from telethon import events from userbot.utils import mellow_cmd @borg.on(mellow_cmd(pattern=r"upb")) async def batch_upload(event): if event.fwd_from: return temp_dir = Config.TEMP_DIR if os.path.exists(temp_dir): files = os.listdir(temp_dir) files.sort() await event.edit("Uploading Files on Telegram...") for file in files: required_file_name = temp_dir+"/"+file print(required_file_name) await borg.send_file( event.chat_id, required_file_name, force_document=True )
from telethon import events import asyncio import os import sys from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern=r"test")) async def test(event): if event.fwd_from: return await event.edit("Test Successfull. Boss !")
"""Restart or Terminate the bot from any chat Available Commands: .restartsys .shutdown""" # This Source Code Form is subject to the terms of the GNU # General Public License, v.3.0. If a copy of the GPL was not distributed with this # file, You can obtain one at https://www.gnu.org/licenses/gpl-3.0.en.html from telethon import events import asyncio import os import sys from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="restart")) async def _(event): await event.edit("Restarting [⏳⏳] ...") await asyncio.sleep(2) await event.edit("Restarting [⌛⌛⌛]...") await asyncio.sleep(2) await event.edit("Wait its getting restart it will take some time..") await borg.disconnect() os.execl(sys.executable, sys.executable, *sys.argv) # You probably don't need it but whatever quit() @borg.on(mellow_cmd(pattern="shutdown")) async def _(event): if event.fwd_from: return
from telethon import events import asyncio import os import sys import random from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern=r"belo")) async def _(event): if event.fwd_from: return await event.edit("Typing...") await asyncio.sleep(2) x=(random.randrange(1,96)) if x==1:
"`Runs far, far away from earth`", "`Running faster than usian bolt coz I'mma Bot`", "`Runs to Marie`", "`This Group is too cancerous to deal with.`", "`Cya bois`", "`I am a mad person. Plox Ban me.`", "`I go away`", "`I am just walking off, coz me is too fat.`", ] PRO_STRINGS = [ "`Pros here -_- Time to Leave`", ] @borg.on(mellow_cmd(pattern="run ?(.*)")) async def _(event): if event.fwd_from: return bro = random.randint(0, len(RUNSREACTS) - 1) input_str = event.pattern_match.group(1) reply_text = RUNSREACTS[bro] await event.edit(reply_text) @borg.on(mellow_cmd(pattern="metoo ?(.*)")) async def _(event): if event.fwd_from: return bro = random.randint(0, len(METOOSTR) - 1) input_str = event.pattern_match.group(1)
"""Emoji Available Commands: .hypno""" from telethon import events import asyncio from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern=r"hypno")) async def _(event): if event.fwd_from: return animation_interval = 0.8 animation_ttl = range(0, 15) #input_str = event.pattern_match.group(1) #if input_str == "hypno": #await event.edit(input_str) await event.edit("hypnotysing...")
"""Query Indian Financial System Code to get address of the relevant bank or branch Syntax: .ifsc rp <IFSC CODE>""" from telethon import events import requests import json from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="ifsc(.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) url = "https://ifsc.razorpay.com/{}".format(input_str) r = requests.get(url) if r.status_code == 200: b = r.json() a = json.dumps(b, sort_keys=True, indent=4) # https://stackoverflow.com/a/9105132/4723940 await event.edit(str(a)) else: await event.edit("`{}`: {}".format(input_str, r.text))
""" Telegram Channel Media Downloader Plugin for userbot. usage: .geta channel_username [will get all media from channel, tho there is limit of 3000 there to prevent API limits.] .getc number_of_messsages channel_username By: @Zero_cool7870 """ from telethon import events import asyncio import os import subprocess import sys from uniborg.util import mellow_cmd, humanbytes, progress, time_formatter @borg.on(mellow_cmd(pattern=r"getc")) async def get_media(event): if event.fwd_from: return dir = "./temp/" try: os.makedirs("./temp/") except: pass channel_username = event.text command = ['ls', 'temp', '|', 'wc', '-l'] limit = channel_username[6:9] print(limit) channel_username = channel_username[11:] print(channel_username) await event.edit("Downloading Media From this Channel.") msgs = await borg.get_messages(channel_username, limit=int(limit))
""" from telethon import events import asyncio import os import sys import random from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern=r"gotm")) async def _(event): if event.fwd_from: return await event.edit("Thinking... 🤔") await asyncio.sleep(2) x = (random.randrange(1, 30)) if x == 1: await event.edit(
import datetime from telethon import events from telethon.errors.rpcerrorlist import YouBlockedUserError from telethon.tl.functions.account import UpdateNotifySettingsRequest from uniborg.util import mellow_cmd @borg.on(mellow_cmd("mask ?(.*)")) async def _(event): if event.fwd_from: return if not event.reply_to_msg_id: await event.edit("```Reply to any user message.```") return reply_message = await event.get_reply_message() if not reply_message.media: await event.edit("```reply to text message```") return chat = "@hazmat_suit_bot" sender = reply_message.sender if reply_message.sender.bot: await event.edit("```Reply to actual users message.```") return await event.edit("```Processing```") async with borg.conversation(chat) as conv: try: response = conv.wait_event(events.NewMessage(incoming=True,from_users=905164246)) await borg.send_message(chat, reply_message) response = await response except YouBlockedUserError: await event.reply("```Please unblock @sangmatainfo_bot and try again```") return
Online = Remove Offline Tag from your name and change profile pic to vars PROFILE_IMAGE. Note - If you have a last name remove it unless it automatically removed. """ import os, urllib from telethon import events from telethon.tl import functions from uniborg.util import mellow_cmd OFFLINE_TAG = "[OFFLINE]" ONLINE_TAG = "[ONLINE]" PROFILE_IMAGE = os.environ.get( "PROFILE_IMAGE", "https://telegra.ph/file/9f0638dbfa028162a8682.jpg") @borg.on(mellow_cmd(pattern="offline")) # pylint:disable=E0602 async def _(event): if event.fwd_from: return user_it = "me" user = await event.client.get_entity(user_it) if user.first_name.startswith(OFFLINE_TAG): await event.edit("**Already in Offline Mode.**") return await event.edit("**Changing Profile to Offline...**") if not os.path.isdir(Config.TMP_DOWNLOAD_DIRECTORY): # pylint:disable=E0602 os.makedirs(Config.TMP_DOWNLOAD_DIRECTORY) # pylint:disable=E0602 urllib.request.urlretrieve( "https://telegra.ph/file/249f27d5b52a87babcb3f.jpg", "donottouch.jpg") photo = "donottouch.jpg" if photo:
import re import urllib.parse from os import popen from random import choice import requests from bs4 import BeautifulSoup from humanize import naturalsize from telethon import events from telethon.tl import functions, types from uniborg.util import mellow_cmd #@borg.on(events.NewMessage(pattern=r"^.direct(?: |$)([\s\S]*)", outgoing=True)) @borg.on(mellow_cmd(pattern=r"direct(?: |$)([\s\S]*)")) async def direct_link_generator(request): """ direct links generator """ await request.edit("`Processing...`") textx = await request.get_reply_message() message = request.pattern_match.group(1) if message: pass elif textx: message = textx.text else: await request.edit("`Usage: .direct <url>`") return reply = '' links = re.findall(r'\bhttps?://.*\.\S+', message) if not links:
from telethon import events from uniborg.util import mellow_cmd import asyncio @borg.on(mellow_cmd(pattern="undlt")) async def _(event): if event.fwd_from: return c = await event.get_chat() if c.admin_rights or c.creator: a = await borg.get_admin_log(event.chat_id,limit=5, search="", edit=False, delete=True) for i in a: await event.reply(i.original.action.message) else: await event.edit("You need administrative permissions in order to do this command") await asyncio.sleep(3) await event.delete()
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # (c) Shrimadhav U K import asyncio from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="type (.*)")) async def _(event): if event.fwd_from: return # https://t.me/AnotherGroup/176551 input_str = event.pattern_match.group(1) shiiinabot = "\u2060" for i in range(601): shiiinabot += "\u2060" try: await event.edit(shiiinabot) except Exception as e: logger.warn(str(e)) typing_symbol = "|" DELAY_BETWEEN_EDITS = 0.3 previous_text = "" await event.edit(typing_symbol) await asyncio.sleep(DELAY_BETWEEN_EDITS) for character in input_str: previous_text = previous_text + "" + character typing_text = previous_text + "" + typing_symbol try: await event.edit(typing_text) except Exception as e:
"""Profile Updation Commands .pbio <Bio> .pname <Name> .ppic""" import os from telethon import events from telethon.tl import functions from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="pbio (.*)")) # pylint:disable=E0602 async def _(event): if event.fwd_from: return bio = event.pattern_match.group(1) try: await borg( functions.account.UpdateProfileRequest( # pylint:disable=E0602 about=bio)) await event.edit("Succesfully changed my profile bio") except Exception as e: # pylint:disable=C0103,W0703 await event.edit(str(e)) @borg.on(mellow_cmd(pattern="pname ((.|\n)*)")) # pylint:disable=E0602,W0703 async def _(event): if event.fwd_from: return names = event.pattern_match.group(1) first_name = names last_name = ""
"""XKCD Search Syntax: .xkcd <search>""" from telethon import events import asyncio import json import requests from urllib.parse import quote from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="xkcd ?(.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) xkcd_id = None if input_str: if input_str.isdigit(): xkcd_id = input_str else: xkcd_search_url = "https://relevantxkcd.appspot.com/process?" queryresult = requests.get(xkcd_search_url, params={ "action": "xkcd", "query": quote(input_str) }).text xkcd_id = queryresult.split(" ")[2].lstrip("\n") if xkcd_id is None: xkcd_url = "https://xkcd.com/info.0.json" else: xkcd_url = "https://xkcd.com/{}/info.0.json".format(xkcd_id)
"templates": "<b>Available Templates:</b> <code>{}</code>", "cannot_send_stickers": "<b>You cannot send stickers in this chat.</b>", "admin": "admin", "creator": "creator", "hidden": "hidden", "channel": "Channel" } config = dict({"api_token": os.environ.get("API_TOKEN"), "api_url": "http://api.antiddos.systems", "username_colors": ["#fb6169", "#faa357", "#b48bf2", "#85de85", "#62d4e3", "#65bdf3", "#ff5694"], "default_username_color": "#b48bf2"}) client = borg @borg.on(mellow_cmd(pattern="chat(.*)")) async def quotecmd(message): # noqa: C901 """Quote a message. Usage: .quote [template] If template is missing, possible templates are fetched.""" await message.delete() args = message.raw_text.split(" ")[1:] if args == []: args = ["default"] reply = await message.get_reply_message() if not reply: return await message.respond(strings["no_reply"]) if not args: return await message.respond(strings["no_template"])
"https://telegra.ph/file/aff5223e1aa29f212a46a.jpg", "https://telegra.ph/file/45ccfa3ef878bea9cfc02.jpg", "https://telegra.ph/file/a38aa50d009835177ac16.jpg", "https://telegra.ph/file/53e25b1b06f411ec051f0.jpg", "https://telegra.ph/file/96e801400487d0a120715.jpg", "https://telegra.ph/file/6ae8e799f2acc837e27eb.jpg", "https://telegra.ph/file/265ff1cebbb7042bfb5a7.jpg", "https://telegra.ph/file/4c8c9cd0751eab99600c9.jpg", "https://telegra.ph/file/1c6a5cd6d82f92c646c0f.jpg", "https://telegra.ph/file/2c1056c91c8f37fea838a.jpg", "https://telegra.ph/file/f140c121d03dfcaf4e951.jpg", "https://telegra.ph/file/39f7b5d1d7a3487f6ba69.jpg" ] @borg.on(mellow_cmd(pattern="rpc ?(.*)")) async def autopic(event): while True: piclink = random.randint(0, len(TELEGRAPH_MEDIA_LINKS) - 1) AUTOPP = TELEGRAPH_MEDIA_LINKS[piclink] downloaded_file_name = "./DOWNLOADS/original_pic.png" downloader = SmartDL(AUTOPP, downloaded_file_name, progress_bar=True) downloader.start(blocking=False) photo = "photo_pfp.png" while not downloader.isFinished(): place_holder = None shutil.copy(downloaded_file_name, photo) im = Image.open(photo) current_time = datetime.now().strftime( "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n Time: %H:%M:%S \n Date: %d/%m/%y "
from telethon import events from datetime import datetime from uniborg.util import mellow_cmd import importlib.util import asyncio import random import importlib.util @borg.on(mellow_cmd(pattern='(f?c)d ')) async def timer_blankx(e): txt = e.text[4:] + '\nDeleting in ' j = 86400 k = j for j in range(j): await e.edit(txt + str(k)) k = k - 50 await asyncio.sleep(50)
"""Emoji Available Commands: .emoji shrug .emoji apple .emoji :/ .emoji -_-""" from telethon import events import asyncio from uniborg.util import mellow_cmd @borg.on(mellow_cmd(pattern="emoji (.*)")) async def _(event): if event.fwd_from: return animation_interval = 0.3 animation_ttl = range(0, 16) input_str = event.pattern_match.group(1) if input_str == "shrug": await event.edit("¯\_(ツ)_/¯") elif input_str == "apple": await event.edit("\uF8FF") elif input_str == ":/": await event.edit(input_str) animation_chars = [":\\", ":/"] for i in animation_ttl: await asyncio.sleep(animation_interval) await event.edit(animation_chars[i % 2]) elif input_str == "-_-": await event.edit(input_str) animation_chars = ["-__-", "-_-"]