from datetime import datetime from telethon.tl.types import Channel, Chat, User from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @bot.on(friday_on_cmd(pattern=r"stats")) async def _(event): if event.fwd_from: return start = datetime.now() u = 0 g = 0 c = 0 bc = 0 b = 0 dialogs = await bot.get_dialogs(limit=None, ignore_migrated=True) for d in dialogs: currrent_entity = d.entity if type(currrent_entity) is User: if currrent_entity.bot: b += 1 else: u += 1 elif type(currrent_entity) is Chat: g += 1 elif type(currrent_entity) is Channel: if currrent_entity.broadcast: bc += 1
import asyncio from telethon.tl.types import InputMediaUploadedPhoto from uniborg.util import friday_on_cmd, edit_or_reply, sudo_cmd from fridaybot.modules.sql_helper.broadcast_sql import ( add_channel, get_all_channels, in_channels, rm_channel, ) from var import Var logs_id = Var.PRIVATE_GROUP_ID @friday.on(friday_on_cmd("bforward ?(.*)")) @friday.on(sudo_cmd("bforward ?(.*)", allow_sudo=True)) async def forw(event): if event.fwd_from: return if not event.is_reply: await edit_or_reply(event, "Reply to a message to broadcast.") return channels = get_all_channels() await edit_or_reply(event, "Sending...") error_count = 0 sent_count = 0 if event.reply_to_msg_id: previous_message = await event.get_reply_message() previous_message.message previous_message.raw_text
async def await_read(chat, message): chat = telethon.utils.get_peer_id(chat) async def read_filter(read_event): return read_event.chat_id == chat and read_event.is_read(message) fut = borg.await_event(events.MessageRead(inbox=False), read_filter) if await is_read(borg, chat, message): fut.cancel() return await fut @friday.on(friday_on_cmd(pattern="(del)(?:ete)?$")) @friday.on(friday_on_cmd(pattern="(edit)(?:\s+(.*))?$")) async def delete(event): if event.fwd_from: return await event.delete() command = event.pattern_match.group(1) if command == "edit": text = event.pattern_match.group(2) if not text: return target = await get_target_message(event) if target: chat = await event.get_input_chat() if command == "edit": await borg.edit_message(chat, target, text)
from telethon.tl.functions.photos import DeletePhotosRequest, GetUserPhotosRequest from telethon.tl.types import InputPhoto from uniborg.util import edit_or_reply, friday_on_cmd, sudo_cmd @friday.on(friday_on_cmd(pattern="delpfp ?(.*)")) @friday.on(sudo_cmd(pattern="delpfp ?(.*)", allow_sudo=True)) async def remove_profilepic(delpfp): """ For .delpfp command, delete your current profile picture in Telegram. """ group = delpfp.text[8:] if group == "all": lim = 0 elif group.isdigit(): lim = int(group) else: lim = 1 pfplist = await delpfp.client( GetUserPhotosRequest(user_id=delpfp.from_id, offset=0, max_id=0, limit=lim)) input_photos = [] for sep in pfplist.photos: input_photos.append( InputPhoto( id=sep.id, access_hash=sep.access_hash, file_reference=sep.file_reference, )) await delpfp.client(DeletePhotosRequest(id=input_photos))
""".admin Plugin for @UniBorg""" from telethon.tl.types import ChannelParticipantsAdmins from uniborg.util import friday_on_cmd @friday.on(friday_on_cmd(pattern="admins")) async def _(event): if event.fwd_from: return mentions = "@admin: **Spam Spotted**" chat = await event.get_input_chat() async for x in borg.iter_participants(chat, filter=ChannelParticipantsAdmins): mentions += f"[\u2063](tg://user?id={x.id})" reply_message = None if event.reply_to_msg_id: reply_message = await event.get_reply_message() await reply_message.reply(mentions) else: await event.reply(mentions) await event.delete()
# Copyright (c) By Midhun KM [@StarkXD] # I Am Noob # Official Web : nekobot.xyz # "Copy It As You Want But Don't Edit Credits" import requests from uniborg.util import edit_or_reply, friday_on_cmd, sudo_cmd @friday.on(friday_on_cmd("ttt ?(.*)")) @friday.on(sudo_cmd("ttt ?(.*)", allow_sudo=True)) async def noobishere(event): reply_to_id = event.message.id if event.reply_to_msg_id: reply_to_id = event.reply_to_msg_id reply = await event.get_reply_message() if event.pattern_match.group(1): ipman = event.pattern_match.group(1) elif reply.text: ipman = reply.message else: await edit_or_reply(event, "Trump : What Should I Tweet For You ?") return url = f"https://nekobot.xyz/api/imagegen?type=trumptweet&text={ipman}" starkgang = requests.get(url=url).json() meikobot = starkgang.get("message") tweetimg = meikobot starkxd = f"Trump Has Tweeted {ipman}" await edit_or_reply(event, "Trump : Wait I Am Tweeting Your Texts") await event.client.send_file(event.chat_id, tweetimg,
from fridaybot.utils import admin_cmd from sys import argv import urllib3 import os from fridaybot.utils import friday_on_cmd data = { "User-Agent": "NordApp android (playstore/2.8.6) Android 9.0.0", "Content-Length": "55", "Accept-Encoding": "gzip" } data2 = {"accept-encoding": "gzip", "user-agent": "RemotrAndroid/1.5.0"} @friday.on(friday_on_cmd(pattern="cz5$")) async def zee5(event): await event.edit( '`Checking Your Combos. This May Take Time Depending On No of Combos.`' ) stark_dict = [] hits_dict = [] hits = 0 bads = 0 lol = await event.get_reply_message() starky = await borg.download_media(lol.media, Config.TMP_DOWNLOAD_DIRECTORY) file = open(starky, "r") lines = file.readlines() for line in lines: stark_dict.append(line)
"""Syntax: .meaning <word>""" from PyDictionary import PyDictionary from uniborg.util import edit_or_reply, friday_on_cmd, sudo_cmd from fridaybot import CMD_HELP @friday.on(friday_on_cmd("meaning (.*)")) @friday.on(sudo_cmd("meaning (.*)", allow_sudo=True)) async def _(event): omg = await edit_or_reply(event, "Finding Meaning.....") if event.fwd_from: return input_str = event.pattern_match.group(1) dictionary = PyDictionary() a = dictionary.meaning(input_str) try: b = a.get("Noun") except: await omg.edit("Couldn't Find Meaning Of Given Word") messi = "" for x in b: messi += x + "\n" await omg.edit( f"<b> meaning of {input_str} is:-</b>\n{messi}", parse_mode="HTML", )
# 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. from faker import Faker from faker.providers import internet from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @friday.on(friday_on_cmd(pattern=r"fakegen")) async def hi(event): if event.fwd_from: return fake = Faker() print("FAKE DETAILS GENERATED\n") name = str(fake.name()) fake.add_provider(internet) address = str(fake.address()) ip = fake.ipv4_private() cc = fake.credit_card_full() email = fake.ascii_free_email() job = fake.job() android = fake.android_platform_token() pc = fake.chrome() await event.edit(
# 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 uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @friday.on(friday_on_cmd(pattern="tagall")) async def _(event): if event.fwd_from: return mentions = "@tagall" chat = await event.get_input_chat() async for x in borg.iter_participants(chat, 100): mentions += f"[\u2063](tg://user?id={x.id})" await event.reply(mentions) await event.delete() CMD_HELP.update( { "tagall": "**Tagall**\ \n\n**Syntax : **`.tagall`\ \n**Usage :** tag everyone in a group" } )
from telethon.tl.types import ( ChannelParticipantsKicked, ChatBannedRights, UserStatusEmpty, UserStatusLastMonth, UserStatusLastWeek, UserStatusOffline, UserStatusOnline, UserStatusRecently, ) from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @friday.on(friday_on_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)
"chucks", "hurls", ] HIT = [ "hits", "whacks", "slaps", "smacks", "bashes", ] DEFAULTUSER = str(ALIVE_NAME) if ALIVE_NAME else "FridayUserbot" @friday.on(friday_on_cmd(pattern="slap ?(.*)", allow_sudo=True)) async def who(event): if event.fwd_from: return replied_user = await get_user(event) caption = await slap(replied_user, event) message_id_to_reply = event.message.reply_to_msg_id if not message_id_to_reply: message_id_to_reply = None try: await event.edit(caption) except: await event.edit("`Can't slap this nibba !!`")
"""Emoji Available Commands: .emoji shrug .emoji apple .emoji :/ .emoji -_-""" import asyncio from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @friday.on(friday_on_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 == "-_-":
input_str = event.pattern_match.group(1) stats = PasswordStats(input_str) sedbruh = stats.strength() if stats.strength() >= 0.2: await event.edit( f"<b><u>Password Checked</b></u> \n<b>Password :</b> <code>{input_str}</code> \n<b>Strength :</b> <code>{sedbruh}</code> \n<b>Result :</b> <code>Good Password</code>", parse_mode="HTML", ) else: await event.edit( f"<b><u>Password Checked</b></u> \n<b>Password :</b> <code>{input_str}</code> \n<b>Strength :</b> <code>{sedbruh}</code> \n<b>Result :</b> <code>Bad Password</code>", parse_mode="HTML", ) @friday.on(friday_on_cmd(pattern=r"passgen")) async def hi(event): if event.fwd_from: return okbabe = secrets.token_urlsafe(16) stats = PasswordStats(okbabe) sedbruh = stats.strength() await event.edit( f"<b>Password</b> : <code>{okbabe}</code> \n<b>Strength :</b> <code>{sedbruh}</code>", parse_mode="HTML", ) CMD_HELP.update({ "password_tools": "**Password Tools**\
RUNSREACTS = [ "`Congratulations and BRAVO!`", "`You did it! So proud of you!`", "`This calls for celebrating! Congratulations!`", "`I knew it was only a matter of time. Well done!`", "`Congratulations on your well-deserved success.`", "`Heartfelt congratulations to you.`", "`Warmest congratulations on your achievement.`", "`Congratulations and best wishes for your next adventure!”`", "`So pleased to see you accomplishing great things.`", "`Feeling so much joy for you today. What an impressive achievement!`", ] @friday.on(friday_on_cmd(pattern="congo")) @friday.on(sudo_cmd(pattern="congo", allow_sudo=True)) async def _(event): if event.fwd_from: return bro = random.randint(0, len(RUNSREACTS) - 1) reply_text = RUNSREACTS[bro] await edit_or_reply(event, reply_text) CMD_HELP.update( { "congratulations": "**Congratulations**\ \n\n**Syntax : **`.congo`\ \n**Usage :** This plugin is used to congratulate someone." }
"""use command .ducduckgo""" from uniborg.util import friday_on_cmd from virtualuserbot import CMD_HELP @friday.on(friday_on_cmd("ducduckgo (.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) sample_url = "https://duckduckgo.com/?q={}".format( input_str.replace(" ", "+")) if sample_url: link = sample_url.rstrip() await event.edit( "Let me 🦆 DuckDuckGo that for you:\n🔎 [{}]({})".format( input_str, link)) else: await event.edit("something is wrong. please try again later.") CMD_HELP.update({ "duckduckgo": "**Duckduckgo**\ \n\n**Syntax : **`.ducduckgo <query>`\ \n**Usage :** get duckduckgo search query link" })
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """ Userbot module for frying stuff. ported by @NeoMatrix90 """ import io from random import randint, uniform from PIL import Image, ImageEnhance, ImageOps from telethon.tl.types import DocumentAttributeFilename from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @friday.on(friday_on_cmd(pattern="deepfry(?: |$)(.*)", outgoing=True)) async def deepfryer(event): try: frycount = int(event.pattern_match.group(1)) if frycount < 1: raise ValueError except ValueError: frycount = 1 if event.is_reply: reply_message = await event.get_reply_message() data = await check_media(reply_message) if isinstance(data, bool): await event.edit("`I can't deep fry that!`") return
"`You should try sleeping forever.`", "`Pick up a gun and shoot yourself.`", "`Try bathing with Hydrochloric Acid instead of water.`", "`Go Green! Stop inhaling Oxygen.`", "`God was searching for you. You should leave to meet him.`", "`You should Volunteer for target in an firing range.`", "`Try playing catch and throw with RDX its fun.`", "`People like you are the reason we have middle fingers.`", "`When your mom dropped you off at the school, she got a ticket for littering.`", "`You’re so ugly that when you cry, the tears roll down the back of your head…just to avoid your face.`", "`If you’re talking behind my back then you’re in a perfect position to kiss my a**!.`", ] # =========================================== @friday.on(friday_on_cmd(pattern="run ?(.*)")) @friday.on(sudo_cmd(pattern="run ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return bro = random.randint(0, len(RUNSREACTS) - 1) event.pattern_match.group(1) reply_text = RUNSREACTS[bro] await edit_or_reply(event, reply_text) @friday.on(friday_on_cmd(pattern="metoo ?(.*)")) @friday.on(sudo_cmd(pattern="metoo ?(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return
GDNIGHT = ( "Have a very, good night, friend! You are wonderful!", "Friend, you do not hesitate to get things done! Take tonight to relax and do more, tomorrow!", "Rest soundly tonight, friend!", "Good night to a friend who is the best! Get your forty winks!", "Let there be no troubles, dear friend! Have a Good Night!", ) GDNOON = ( "Good afternoon!", "Forget about yesterday, think about tommorow.. The victory will be yours.", "Do what you have to do right now.. Good Afternoon.", ) @friday.on(friday_on_cmd(pattern=r"gmt$")) async def morning(event): if event.fwd_from: return txt = random.choice(GDMORNING) await edit_or_reply(event, txt) @friday.on(friday_on_cmd(pattern=r"gnoon$")) async def noon(event): if event.fwd_from: return txt = random.choice(GDNOON) await edit_or_reply(event, txt)
pm_caption += "⛄ **SYSTEMS STATS**\n" pm_caption += "⛄ **Telethon Version:** `1.15.0` \n" pm_caption += "⛄ **Python:** `3.7.4` \n" pm_caption += f"⛄ **Uptime** : `{uptime}` \n" pm_caption += "⛄ **Database Status:** `Functional`\n" pm_caption += "⛄ **Current Branch** : `master`\n" pm_caption += f"⛄ **Version** : `5.0`\n" pm_caption +=f"⛄ **My Boss** : {DEFAULTUSER} \n" pm_caption += "⛄ **Heroku Database** : `AWS - Working Properly`\n\n" pm_caption += "⛄ **License** : [GNU General Public License v3.0](github.com/StarkGang/FridayUserbot/blob/master/LICENSE)\n" pm_caption += "⛄ **Copyright** : By [Bruce Wayne](https://t.me/BruceSL)\n" pm_caption += "⛄ **Check Stats By Doing** `.stat`. \n\n" @friday.on(friday_on_cmd(pattern=r"alive")) @friday.on(sudo_cmd(pattern=r"alive", allow_sudo=True)) async def friday(alive): await alive.get_chat() """ For .alive command, check if the bot is running. """ await borg.send_file(alive.chat_id, PM_IMG, caption=pm_caption) await alive.delete() CMD_HELP.update( { "alive": "**ALive**\ \n\n**Syntax : **`.alive`\ \n**Usage :** Check if UserBot is Alive" } )
base by: @r4v4n4 created by: @A_Dark_Princ3 """ import asyncio from telethon.errors.rpcerrorlist import YouBlockedUserError from telethon.tl.types import MessageMediaPhoto from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP thumb_image_path = Config.TMP_DOWNLOAD_DIRECTORY + "/thumb_image.jpg" @friday.on(friday_on_cmd("mmf ?(.*)")) async def _(event): hmm = event.chat_id if event.fwd_from: return if not event.reply_to_msg_id: await event.edit("`Syntax: reply to an image with .mmf And Text `") return reply_message = await event.get_reply_message() if not reply_message.media: await event.edit("```reply to a image/sticker/gif```") return reply_message.sender if reply_message.sender.bot: await event.edit("```Reply to actual users message.```") return
# 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/. """WikiPedia.ORG Syntax: .wikipedia Query""" import wikipedia from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @friday.on(friday_on_cmd(pattern="wikipedia (.*)")) async def _(event): if event.fwd_from: return await event.edit("Processing ...") input_str = event.pattern_match.group(1) result = "" results = wikipedia.search(input_str) for s in results: try: page = wikipedia.page(s) url = page.url result += f"> [{s}]({url}) \n" except: pass await event.edit("WikiPedia **Search**: {} \n\n **Result**: \n\n{}".format( input_str, result)) CMD_HELP.update({
import random import requests from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @friday.on(friday_on_cmd(pattern="quote ?(.*)")) async def quote_search(event): if event.fwd_from: return await event.edit("Processing...") search_string = event.pattern_match.group(1) input_url = "https://bots.shrimadhavuk.me/Telegram/GoodReadsQuotesBot/?q={}".format( search_string ) headers = {"USER-AGENT": "UniBorg"} try: response = requests.get(input_url, headers=headers).json() except: response = None if response is not None: result = ( random.choice(response).get("input_message_content").get("message_text") ) else: result = None if result: await event.edit(result.replace("<code>", "`").replace("</code>", "`")) else:
"""Get info about a File Extension Syntax: .filext EXTENSION""" import requests from bs4 import BeautifulSoup from uniborg.util import friday_on_cmd from virtualuserbot import CMD_HELP @friday.on(friday_on_cmd(pattern="filext (.*)")) async def _(event): if event.fwd_from: return await event.edit("Processing ...") sample_url = "https://www.fileext.com/file-extension/{}.html" input_str = event.pattern_match.group(1).lower() response_api = requests.get(sample_url.format(input_str)) status_code = response_api.status_code if status_code == 200: raw_html = response_api.content soup = BeautifulSoup(raw_html, "html.parser") ext_details = soup.find_all("td", {"colspan": "3"})[-1].text await event.edit( "**File Extension**: `{}`\n**Description**: `{}`".format( input_str, ext_details)) else: await event.edit( "https://www.fileext.com/ responded with {} for query: {}".format( status_code, input_str))
"""Malayalam Calendar plugin for Indian Bot SYNTAX: .calendar YYYY-MM-DD""" import json from datetime import datetime import requests from uniborg.util import friday_on_cmd @friday.on(friday_on_cmd(pattern="calendar (.*)")) async def _(event): if event.fwd_from: return start = datetime.now() input_str = event.pattern_match.group(1) input_sgra = input_str.split("-") if len(input_sgra) == 3: yyyy = input_sgra[0] mm = input_sgra[1] dd = input_sgra[2] required_url = "https://calendar.kollavarsham.org/api/years/{}/months/{}/days/{}?lang={}".format( yyyy, mm, dd, "en") headers = {"Accept": "application/json"} response_content = requests.get(required_url, headers=headers).json() a = "" if "error" not in response_content: current_date_detail_arraays = response_content["months"][0][ "days"][0] a = json.dumps(current_date_detail_arraays, sort_keys=True, indent=4)
"""XKCD Search Syntax: .xkcd <search>""" from urllib.parse import quote import requests from uniborg.util import edit_or_reply, friday_on_cmd, sudo_cmd from virtualuserbot import CMD_HELP @friday.on(friday_on_cmd(pattern="xkcd ?(.*)")) @friday.on(sudo_cmd(pattern="xkcd ?(.*)", allow_sudo=True)) async def _(event): livinglegend = await edit_or_reply(event, "Oh SeD Pls Wait") 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"
# # 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. import requests from uniborg.util import friday_on_cmd from fridaybot import CMD_HELP @friday.on(friday_on_cmd(pattern="ifsc (.*)")) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) IFSC_Code = input_str URL = "https://ifsc.razorpay.com/" data = requests.get(URL + IFSC_Code).json() a = data["ADDRESS"] b = data["CENTRE"] c = data["BRANCH"] d = data["CITY"]
# You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. import asyncio import time from telethon.errors import FloodWaitError from telethon.tl import functions from uniborg.util import edit_or_reply, friday_on_cmd, sudo_cmd from apscheduler.schedulers.asyncio import AsyncIOScheduler from apscheduler.executors.asyncio import AsyncIOExecutor from fridaybot.function.auto_tools import auto_name, auto_bio, auto_pic from fridaybot import ALIVE_NAME, CMD_HELP scheduler = AsyncIOScheduler(executors={'default': AsyncIOExecutor()}) @friday.on(friday_on_cmd(pattern="autoname(?: |$)(.*)")) @friday.on(sudo_cmd(pattern="autoname(?: |$)(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return sed = await edit_or_reply(event, "`Started AutoName Your Name Will Be Changed Every 1 Min, According To TimeZone Given. To Terminate This Process Use .stop Cmd`") scheduler.add_job(auto_name, 'interval', args=[event.pattern_match.group(1)], minutes=1, id='autoname') @friday.on(friday_on_cmd(pattern="autopic(?: |$)(.*)")) @friday.on(sudo_cmd(pattern="autopic(?: |$)(.*)", allow_sudo=True)) async def _(event): if event.fwd_from: return sed = await edit_or_reply(event, "`Started AutoPic Your Name Will Be Changed Every 1 Min, According To TimeZone Given. To Terminate This Process Use .stop Cmd`") scheduler.add_job(auto_pic, 'interval', minutes=1, id='autopic')
"""Profile Updation Commands .pbio <Bio> .pname <Name> .ppic""" import os from telethon.tl import functions from uniborg.util import friday_on_cmd @friday.on(friday_on_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(about=bio) # pylint:disable=E0602 ) await event.edit("Succesfully changed my profile bio") except Exception as e: # pylint:disable=C0103,W0703 await event.edit(str(e)) @friday.on(friday_on_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 = ""
"""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/. import inspect import asyncio import io import sys import traceback from telethon import events, errors, functions, types from uniborg.util import friday_on_cmd, edit_or_reply, sudo_cmd @friday.on(friday_on_cmd("eval")) @friday.on(sudo_cmd("eval", allow_sudo=True)) async def _(event): if event.fwd_from: return await edit_or_reply(event, "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