from time import sleep from urllib.parse import quote_plus from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from thunderbot import CHROME_DRIVER, CMD_HELP, GOOGLE_CHROME_BIN from thunderbot.utils import admin_cmd, sudo_cmd CARBONLANG = "auto" LANG = "en" @thunderbot.on(admin_cmd(pattern="carbon")) @thunderbot.on(sudo_cmd(pattern="carbon", allow_sudo=True)) async def carbon_api(e): if not e.text[0].isalpha() and e.text[0] not in ("/", "#", "@", "!"): """ A Wrapper for carbon.now.sh """ await eor(e, "`Processing..`") CARBON = "https://carbon.now.sh/?l={lang}&code={code}" global CARBONLANG textx = await e.get_reply_message() pcode = e.text if pcode[8:]: pcodee = str(pcode[8:]) if "|" in pcodee: pcode, skeme = pcodee.split("|") else: pcode = pcodee
send_stickers=None, send_gifs=None, send_games=None, send_inline=None, embed_links=None, ) MUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=True) UNMUTE_RIGHTS = ChatBannedRights(until_date=None, send_messages=False) BOTLOG_CHATID = Var.PRIVATE_GROUP_ID @thunderbot.on(admin_cmd(outgoing=True, pattern="setgpic")) @thunderbot.on(sudo_cmd(outgoing=True, pattern="setgpic", allow_sudo=True)) @errors_handler async def set_group_photo(gpic): """ For .setgpic command, changes the picture of a group """ if not gpic.is_group: await gpic.eor(event, "`I don't think this is a group.`") return replymsg = await gpic.get_reply_message() chat = await gpic.get_chat() admin = chat.admin_rights creator = chat.creator photo = None if not admin and not creator: x = await gpic.eor(x, NO_ADMIN) return
from telethon.errors import ( ChannelInvalidError, ChannelPrivateError, ChannelPublicGroupNaError, ) from telethon.tl.functions.channels import GetFullChannelRequest, GetParticipantsRequest from telethon.tl.functions.messages import GetFullChatRequest, GetHistoryRequest from telethon.tl.types import ChannelParticipantsAdmins, MessageActionChannelMigrateFrom from telethon.utils import get_input_location from thunderbot import CMD_HELP from thunderbot.utils import admin_cmd, sudo_cmd @thunderbot.on(admin_cmd(pattern="chatinfo(?: |$)(.*)", outgoing=True)) @thunderbot.on(sudo_cmd(pattern="chatinfo(?: |$)(.*)")) async def info(event): ok = await eor(event, "`Analysing the chat...`") chat = await get_chatinfo(event) caption = await fetch_info(chat, event) try: await ok.edit(caption, parse_mode="html") except Exception as e: print("Exception:", e) await ok.edit(f"`An unexpected error has occurred. {e}`") return async def get_chatinfo(event): chat = event.pattern_match.group(1) chat_info = None
import asyncio from thunderbot.plugins.sql_helper.mute_sql import is_muted, mute, unmute from thunderbot.utils import admin_cmd, errors_handler, sudo_cmd from thunderbot import CMD_HELP @thunderbot.on(admin_cmd(pattern="mute ?(\d+)?")) @thunderbot.on(sudo_cmd(outgoing=True, pattern="mute ?(\d+)?", allow_sudo=True)) async def startmute(event): private = False if event.fwd_from: return elif event.is_private: await event.edit("Unexpected issues or ugly errors may occur!") await asyncio.sleep(3) private = True if any([ x in event.raw_text for x in ("/mute", "!mute", "amute", "bmute", "cmute", "dmute", "emute", "fmute", "gmute", "hmute", "imute", "jmute", "kmute", "lmute", "mmute", "nmute", "omute", "pmute", "qmute", "rmute", "smute", "tmute", "umute", "vmute", "wmute", "xmute", "ymute", "zmute") ]): await asyncio.sleep(0.5) else: reply = await event.get_reply_message() if event.pattern_match.group(1) is not None: userid = event.pattern_match.group(1) elif reply is not None:
import os import pygments from pygments.formatters import ImageFormatter from pygments.lexers import Python3Lexer from thunderbot import CMD_HELP from thunderbot.utils import admin_cmd, sudo_cmd @thunderbot.on(admin_cmd(pattern=r"ncode")) @thunderbot.on(sudo_cmd(pattern=r"ncode", allow_sudo=True)) async def coder_print(event): a = await event.client.download_media( await event.get_reply_message(), Var.TEMP_DOWNLOAD_DIRECTORY ) s = open(a, "r") c = s.read() s.close() pygments.highlight( f"{c}", Python3Lexer(), ImageFormatter(font_name="DejaVu Sans Mono", line_numbers=True), "result.png", ) res = await event.client.send_message( event.chat_id, "**Pasting this code on my page...**", reply_to=event.reply_to_msg_id, ) await event.client.send_file(