__MODULE__ = "Mega" __HELP__ = """ Download any file from URL or from telegram ──「 **Download mega file from URL** 」── -> `mega (url)` Give url as args to download it. ──「 **List Downloaded** 」── -> `megafile` List of file that have downloaded with mega. """ @app.on_message(Filters.me & Filters.command("mega", Command)) async def mega_download(_client, msg): args = msg.text.split(None, 1) if len(args) == 1: await msg.edit("usage: mega (url)") return await msg.edit("Processing...") if not os.path.exists('nana/downloads/mega'): os.makedirs('nana/downloads/mega') m = Mega() await m.download_url(message=msg, url=args[1], dest_path="nana/downloads/mega") await msg.edit("Success! file was downloaded at nana/downloads")
# 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, progress=progress_for_pyrogram, progress_args=(
#!/usr/bin/env python #! -*- coding: utf-8 -*- # Bu araç @keyiflerolsun tarafından | @BetikSonu için yazılmıştır. from Kaziyicilar.iftarSaati import sahuraKalan, iftaraKalan from pyrogram import Client, Filters @Client.on_message(Filters.command(['iftar'], ['!', '.', '/'])) def iftar(client, message): cevaplanan_mesaj = message.reply_to_message if cevaplanan_mesaj is None: kekik = message.reply("Bekleyin..") else: kekik = message.reply("Bekleyin..", reply_to_message_id=cevaplanan_mesaj.message_id) girilen_yazi = message.text if len(girilen_yazi.split()) == 1: kekik.edit("Arama yapabilmek için `il` girmelisiniz") return il = " ".join(girilen_yazi.split()[1:2]).lower().capitalize().replace( 'I', 'İ') mesaj = f'**{il}** __ili için__ ' try: mesaj += iftaraKalan(il) except: kekik.edit('Bulunamadı..')
api_id=APP_ID, api_hash=API_HASH, workers=343, workdir=DOWNLOAD_LOCATION) # app.set_parse_mode("html") # # incoming_message_handler = MessageHandler( # incoming_message_f, # filters=Filters.command(["leech"]) & Filters.chat(chats=AUTH_CHANNEL) # ) # app.add_handler(incoming_message_handler) # incoming_purge_message_handler = MessageHandler( incoming_purge_message_f, filters=Filters.command(["purge"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_purge_message_handler) # # incoming_youtube_dl_handler = MessageHandler( # incoming_youtube_dl_f, # filters=Filters.command(["ytdl"]) & Filters.chat(chats=AUTH_CHANNEL) # ) # app.add_handler(incoming_youtube_dl_handler) # status_message_handler = MessageHandler(status_message_f, filters=Filters.command(["status"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(status_message_handler) # cancel_message_handler = MessageHandler(cancel_message_f, filters=Filters.command(["cancel"])
from time import sleep from pyrogram import Emoji from pyrogram import Filters, Message from userbot import UserBot from userbot.database.reminders import Reminders from userbot.plugins.help import add_command_help @UserBot.on_message(Filters.command('reminders', '.') & Filters.me) async def show_all_reminders(bot: UserBot, message: Message): reminders = Reminders().get_all_reminders() if len(reminders) != 0: send_text = "**==== My Reminders ====** \n" for reminder in reminders: send_text = send_text + f"{reminder[0]} | **{reminder[1]}**\n" await message.edit(send_text, disable_web_page_preview=True) sleep(20) await message.delete() else: send_text = "** You do not have any reminders **" await message.edit(send_text, disable_web_page_preview=True) sleep(5) await message.delete() @UserBot.on_message(Filters.command("remind", ".") & Filters.me) async def remind(bot: UserBot, message: Message): cmd = message.command
import requests from pyrogram import Client, Filters from pyrouserbot import cmd @Client.on_message(Filters.command(["decide"], cmd) & Filters.me) async def de_cide(client, message): message_id = message.message_id if message.reply_to_message: message_id = message.reply_to_message.message_id JSON = requests.get("https://yesno.wtf/api").json() await message.reply_animation(animation=JSON["image"], caption=JSON["answer"], reply_to_message_id=message_id) await message.delete()
bilgiler = json.load(open("bilgiler.json")) kekikRobot = Client( api_id=bilgiler['api_id'], # my.telegram.org/apps api_hash=bilgiler['api_hash'], # my.telegram.org/apps session_name="@kekikRobot", # Fark Etmez bot_token=bilgiler['bot_token'], # @BotFather plugins=dict(root="botAlani/Eklentiler")) # başlıyoruz from time import time, sleep from os import listdir @kekikRobot.on_message(Filters.command(['start'], ['!', '.', '/'])) async def ilk(client, message): # Hoş Geldin Mesajı await message.reply_chat_action("typing") # yazıyor aksiyonu await message.reply("Hoş Geldin!\n/yardim alabilirsin.") # cevapla # LOG Alanı sohbet = await kekikRobot.get_chat(message.chat.id) log = f"[{message.from_user.first_name}](tg://user?id={message.from_user.id}) | Bota Bağlantı Sağladı" log += f"\n\n**Sohbet Türü :** __{message.chat.type}__" if message.chat.type != 'private': log += f"\n\n\t\t`{sohbet.title}`__'den__ `{message.text}` __yolladı..__" else: log += f"\n\n\t\t`{message.text}` __yolladı..__"
from pyrogram import Client, Filters from pyrobot import COMMAND_HAND_LER # EMOJI CONSTANTS DICE_E_MOJI = "🎲" # EMOJI CONSTANTS @Client.on_message(Filters.command("roll", COMMAND_HAND_LER)) async def roll_dice(client, message): """ @RollADie """ rep_mesg_id = message.message_id if message.reply_to_message: rep_mesg_id = message.reply_to_message.message_id await client.send_dice(chat_id=message.chat.id, emoji=DICE_E_MOJI, disable_notification=True, reply_to_message_id=rep_mesg_id)
-> `yt (text)` Give text as args for search from youtube, will send result more than 10 depending on yt page. ──「 **Download video** 」── -> `ytdl (url)` Download youtube video (mp4), you can select resolutions from the list. ──「 **Convert to music** 」── -> `ytmusic (url)` -> `ytaudio (url)` Download youtube music, and then send to tg as music. """ @app.on_message( Filters.user("self") & Filters.command(["youtube", "yt"], Command)) async def youtube_search(client, message): args = message.text.split(None, 1) if len(args) == 1: await message.edit("Write any args here!") return teks = args[1] responce = requests.get('https://www.youtube.com/results?search_query=' + teks.replace(" ", "%20")) soup = BeautifulSoup(responce.content, "html.parser") divs = soup.find_all("div", {"class": "yt-lockup"}) yutub = "<b>Results of {}</b>\n".format(teks) nomor = 0 for i in divs: title = i.find('h3', {'class': "yt-lockup-title"}).a.get('title') url = i.find('h3', {'class': "yt-lockup-title"}).a.get('href')
import pynewtonmath as newton from pyrogram import Client, Filters from pyrogram.errors import FloodWait import time app = Client("mnnn", bot_token="836655322:AAGlcw1XO_I7ZJqs9iVzQE8RgMbfCcHWxk0", api_id=768402, api_hash="f6420bf67303614279049d48d3e670f6") @app.on_message(Filters.command("derive")) def main(client, message): x = message.text.split(' ')[1] client.send_message(message.chat.id, newton.derive(x) + "thats okk") app.run()
+ "so I can roll you a dice there :D") START_GROUP = ( "Thanks for adding me to your group {0}\n" + "You can either just /roll for a standard six-sided die, or use the [Dice " + "Notation](https://en.wikipedia.org/wiki/Dice_notation#Standard_notation) to " + "roll more die with more sides.\n" + "Use `/roll d10` for a ten-sided dice, or `/roll 4d20` for four 20-sided die. " + "It's that easy {0}") DICE = "Your rolled dice " + Emoji.GAME_DIE # App definition app = Client(session_name="DiceBot") @app.on_message(Filters.command("start") & Filters.private) def start(app: Client, message: Message): message.reply_text( START.format(message.from_user.first_name, Emoji.GAME_DIE), disable_web_page_preview=True, ) @app.on_message(Filters.new_chat_members) def added(app: Client, message: Message): if app.get_me().id in [i.id for i in message.new_chat_members]: app.send_message( message.chat.id, START_GROUP.format(Emoji.GAME_DIE), disable_web_page_preview=True, )
from phrases import start_phrase, help_phrase from dbmodels import Chats from pyrogram import CallbackQueryHandler from chattools import get_uid, store_name, clean_chat import json def start_callback(bot, message): """ callback for /start (private) """ uid = get_uid(message) bot.send_message(uid, start_phrase, parse_mode='html') start_handler = MessageHandler(callback=start_callback, filters=Filters.command('start') & Filters.private) def help_callback(bot, message): """ callback for /help (private) """ uid = get_uid(message) bot.send_message(uid, help_phrase, parse_mode='html') help_handler = MessageHandler(callback=help_callback, filters=Filters.private) def store_names_callback(bot, message): """ stores names for each user, if not already present in DB"""
from pyrogram import Client, Filters, Emoji, ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton import re import time app = Client("Argonauta", bot_token="885550564:AAGN29Ua7Sr7oXd8k76z7of-uEJQrfkAeZg") canale = "argonautashop" admin = "XxNiko221xX" @app.on_message( Filters.command(["start"]) & Filters.private & Filters.chat(admin)) def start(client, message): app.send_message( message.chat.id, "Ciao! Tu e solo tu sei abilitato all'utilizzo di questo bot (che culo).\nDigita qui /primo " + "seguito dal messaggio che vuoi inviare sul canale " + Emoji.BEAMING_FACE_WITH_SMILING_EYES + "\n\nEs: /primo Ciao Mondo!") @app.on_message( Filters.command(["primo"]) & Filters.private & Filters.chat(admin)) def primo(client, message): msg = message.command[1:] msg = " ".join(msg) if msg == "": msg = "Clicca per primo per vincere!" app.send_message( admin,
import aiohttp import youtube_dl from config import cmds from utils import aiowrap from pyrogram import Client, Filters from pyrogram.errors import MessageNotModified last_edit = 0 @aiowrap def extract_info(instance, url, download=True): return instance.extract_info(url, download) @Client.on_message(Filters.command("ytdl", prefixes=".") & Filters.me) async def ytdl(client, message): url = message.text.split(' ',1)[1] if '-m4a' in url: url = url.replace(' -m4a','') ydl = youtube_dl.YoutubeDL({'outtmpl': 'dls/%(title)s-%(id)s.%(ext)s', 'format': '140', 'noplaylist': True}) vid = False else: url = url.replace(' -mp4','') ydl = youtube_dl.YoutubeDL({'outtmpl': 'dls/%(title)s-%(id)s.%(ext)s', 'format': 'mp4', 'noplaylist': True}) vid = True if 'youtu.be' not in url and 'youtube.com' not in url: yt = await extract_info(ydl, 'ytsearch:' + url, download=False) yt = yt['entries'][0] url = 'https://www.youtube.com/watch?v=' + yt['id'] else:
from tobrot.plugins.custom_thumbnail import (save_thumb_nail, clear_thumb_nail) if __name__ == "__main__": # create download directory, if not exist if not os.path.isdir(DOWNLOAD_LOCATION): os.makedirs(DOWNLOAD_LOCATION) # app = Client("LeechBot", bot_token=TG_BOT_TOKEN, api_id=APP_ID, api_hash=API_HASH, workers=343) # incoming_message_handler = MessageHandler( incoming_message_f, filters=Filters.command(["download@jdrivebot"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_message_handler) # incoming_purge_message_handler = MessageHandler( incoming_purge_message_f, filters=Filters.command(["purge"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_purge_message_handler) # incoming_youtube_dl_handler = MessageHandler( incoming_youtube_dl_f, filters=Filters.command(["ytdl@jdrivebot"]) & Filters.chat(chats=AUTH_CHANNEL)) app.add_handler(incoming_youtube_dl_handler) # status_message_handler = MessageHandler(status_message_f,
`verminal` `vscode` `yeti` `zenburn` """ theme = "dracula" bg = "rgba(0, 255, 230, 100)" themes = ['3024-night', 'a11y-dark', 'blackboard', 'base16-dark', 'base16-light', 'cobalt', 'dracula', 'duotone-dark', 'hopscotch', 'lucario', 'material', 'monokai', 'night-owl', 'nord', 'oceanic-next', 'one-light', 'one-dark', 'panda-syntax', 'paraiso-dark', 'seti', 'shades-of-purple', 'solarized-dark', 'solarized-light', 'synthwave-84', 'twilight', 'verminal', 'vscode', 'yeti', 'zenburn'] @app.on_message(Filters.me & Filters.command(["carbon"], Command)) async def carbon(client, message): cmd = message.command text = "" if len(cmd) > 1: text = " ".join(cmd[1:]) elif message.reply_to_message and len(cmd) == 1: text = message.reply_to_message.text elif not message.reply_to_message and len(cmd) == 1: await message.edit("Usage: `carbon (reply to a text)`") await asyncio.sleep(2) await message.delete() return await message.edit("Carbonizing the Code") try: carbon_result = requests.get(
def time_formatter(milliseconds: int) -> str: """Inputs time in milliseconds, to get beautified time, as string""" seconds, milliseconds = divmod(int(milliseconds), 1000) minutes, seconds = divmod(seconds, 60) hours, minutes = divmod(minutes, 60) days, hours = divmod(hours, 24) tmp = ((str(days) + " day(s), ") if days else "") + \ ((str(hours) + " hour(s), ") if hours else "") + \ ((str(minutes) + " minute(s), ") if minutes else "") + \ ((str(seconds) + " second(s), ") if seconds else "") + \ ((str(milliseconds) + " millisecond(s), ") if milliseconds else "") return tmp[:-2] @Client.on_message(Filters.command("playlista", COMMAND_HAND_LER) & Filters.me) async def ytdl_(client: Client, message): url = message.command[1] type = message.command[1] out_folder = TMP_DOWNLOAD_DIRECTORY + "youtubedl/" thumb_image_path = TMP_DOWNLOAD_DIRECTORY + "/thumb_image.jpg" if not os.path.isdir(out_folder): os.makedirs(out_folder) await message.edit_text("`Preparing to download...`") if type: opts = { 'format': 'bestaudio', 'addmetadata': True,
global CURRENT_COUNTER if not CURRENT_COUNTER.get(message.chat.id + message.message_id): await message.edit("__[{}] Downloading...__".format("{:.1f}%".format(current * 100 / total))) CURRENT_COUNTER[message.chat.id + message.message_id] = 0 CURRENT_COUNTER[message.chat.id + message.message_id] += 1 if CURRENT_COUNTER[message.chat.id + message.message_id] % 20 == 0: try: await message.edit("__[{}] Downloading...__".format("{:.1f}%".format(current * 100 / total))) except Exception as err: print("Error: failed to edit message: " + str(err)) print("{:.1f}%".format(current * 100 / total)) else: print("{:.1f}%".format(current * 100 / total)) @app.on_message(Filters.user("self") & Filters.command(["gdrive"], Command)) async def gdrive_stuff(client, message): gauth.LoadCredentialsFile("nana/session/drive") if gauth.credentials is None: await message.edit("You are not logged in to your google drive account!\nCheck your saved messages for more information!") gdriveclient = os.path.isfile("client_secrets.json") if not gdriveclient: await message.send_message(Owner, "Hello, look like you're not logged in to google drive 🙂\nI can help you to login.\n\nFirst of all, you need to activate your google drive API\n1. [Go here](https://developers.google.com/drive/api/v3/quickstart/python), click **Enable the drive API**\n2. Login to your google account (skip this if you're already logged in)\n3. After logged in, click **Enable the drive API** again, and click **Download Client Configuration** button, download that.\n4. After downloaded that file, rename `credentials.json` to `client_secrets.json`, and upload to your bot dir (not in nana dir)\nor if you're using heroku, read this alternate guide\n4a. Open `credentials.json`, copy all text from that file, then paste **GOOGLE_API_TEXT** with that text\n\nAfter that, you can go next guide by type `/gdrive`") else: await message.send_message(Owner, "Hello, look like you're not logged in to google drive :)\nI can help you to login.\n\n**To login Google Drive**\n1. `/gdrive` to get login URL\n2. After you're logged in, copy your Token.\n3. `/gdrive (token)` without `(` or `)` to login, and your session will saved to `nana/session/drive`.\n\nDon't share your session to someone, else they will hack your google drive account!") return elif gauth.access_token_expired: # Refresh them if expired gauth.Refresh() else: # Initialize the saved creds
os.mkdir('nana-old') os.rename('nana', 'nana-old/nana') os.rename('.gitignore', 'nana-old/.gitignore') os.rename('LICENSE', 'nana-old/LICENSE') os.rename('README.md', 'nana-old/README.md') os.rename('requirements.txt', 'nana-old/requirements.txt') os.rename('Procfile', 'nana-old/Procfile') os.rename('runtime.txt', 'nana-old/runtime.txt') update = repo.create_remote('master', REPOSITORY) update.pull('master') os.rename('nana-old/nana/config.py', 'nana/config.py') shutil.rmtree('nana/session/') os.rename('nana-old/nana/session/', 'nana/session/') @app.on_message(Filters.me & Filters.command(["update"], Command)) async def updater(client, message): await message.edit("__Checking update...__") initial = False try: repo = Repo() except NoSuchPathError as error: await message.edit( f"**Update failed!**\n\nError:\n`directory {error} is not found`") return except InvalidGitRepositoryError: repo = Repo.init() initial = True except GitCommandError as error: await message.edit(f'**Update failed!**\n\nError:\n`{error}`') return
from pyrogram import Client, Filters, Message from bot.functions import db_tools, keyboard @Client.on_message( Filters.command('myfc') & ~(Filters.forwarded) & ~(Filters.edited)) def myfc(client: Client, message: Message): mongo = db_tools.use_mongo() query = {'chat.id': message.from_user.id} query_result = mongo.nintendo.find_one(query) if not isinstance(query_result, dict): text = '你沒有設定過好友代碼唷,請先使用 `/addfc` 來新增自己的好友代碼吧!\n' message.reply_text(text, parse_mode='markdown') return # found record text = '我的好友代碼是:`{fcode}`'.format(fcode=query_result['fcode']) message.reply_text(text, parse_mode='markdown', reply_markup=keyboard.myfc())
await client.download_media(message.reply_to_message.audio, file_name="nana/downloads/" + nama) elif message.reply_to_message.voice: nama = "audio_{}.ogg".format(message.reply_to_message.voice) await client.download_media(message.reply_to_message.voice, file_name="nana/downloads/" + nama) elif message.reply_to_message.document: nama = "{}".format(message.reply_to_message.document.file_name) await client.download_media(message.reply_to_message.document, file_name="nana/downloads/" + nama) else: return False return "nana/downloads/" + nama @app.on_message(Filters.user("self") & Filters.command(["dl"], Command)) async def download_from_url(client, message): if len(message.text.split()) == 1: await message.edit("Usage: `dl url filename`") return if not os.path.isdir("nana/downloads"): os.makedirs("nana/downloads") if len(message.text.split()) == 2: URL = message.text.split(None, 1)[1] file_name = URL.split("/")[-1] elif len(message.text.split()) >= 3: URL = message.text.split(None, 2)[1] file_name = message.text.split(None, 2)[2] else: await message.edit("Invaild args given!") return
import time from coffeehouse.api import API from coffeehouse.lydia import LydiaAI from pyrogram import Filters from nana import setbot, AdminSettings, lydia_api lydia_status = False coffeehouse_api = None lydia = None session = None @setbot.on_message(Filters.user(AdminSettings) & Filters.command(["lydia"])) async def lydia_stats(client, message): global lydia_status, coffeehouse_api, lydia, session if lydia_api == "": await message.reply( "`lydia API key is not set!\nSet your lydia API key by adding Config Vars in heroku with " "name lydia_api with value your lydia key API`") return if lydia_status: await message.reply("Turning off lydia...") time.sleep(0.5) lydia_status = False await message.reply("Lydia will not reply your message") else: await message.reply("Turning on lydia...") try: coffeehouse_api = API(lydia_api)
forgive_link = general_link("/forgive", get_start(client, f"forgive_{uid}")) text = (f"{lang('user_id')}{lang('colon')}{code(uid)}\n" f"{lang('action')}{lang('colon')}{code(lang('action_limit'))}\n" f"{lang('action_forgive')}{lang('colon')}{forgive_link}\n") thread(send_message, (client, glovar.host_id, text)) return True except Exception as e: logger.warning(f"Count error: {e}", exc_info=True) finally: glovar.locks["count"].release() return False @Client.on_message(Filters.private & Filters.incoming & ~Filters.command(glovar.all_commands, glovar.prefix) & from_user & host_chat) def deliver_to_guest(client: Client, message: Message) -> bool: # Deliver messages to guest glovar.locks["message"].acquire() try: # Basic data hid = message.chat.id mid = message.message_id _, cid = get_guest(message) # Deliver the message to guest if cid: thread(deliver_host_message, (client, message, cid)) elif glovar.direct_chat: thread(deliver_host_message, (client, message, glovar.direct_chat))
from pyrogram import Client, Filters, StopPropagation, InlineKeyboardButton, InlineKeyboardMarkup @Client.on_message(Filters.command(["start"]), group=-2) async def start(client, message): # return joinButton = InlineKeyboardMarkup([ [InlineKeyboardButton("Channel", url="https://t.me/Xdfyt_DL")], [InlineKeyboardButton( "Report Bugs 😊", url="https://t.me/MennerDaendels")] ]) welcomed = f"Hey <b>{message.from_user.first_name}</b>\n/help for More info" await message.reply_text(welcomed, reply_markup=joinButton) raise StopPropagation
from pyrogram import Client, Filters, StopPropagation, InlineKeyboardButton, InlineKeyboardMarkup @Client.on_message(Filters.command( ["jihaad", "hamis", "hamis@JihaadBot", "jihaad@JihaadBot"]), group=-2) async def jihaad(client, message): # return juhudbutton = InlineKeyboardMarkup([ [ InlineKeyboardButton("Ibaada Bora", url="https://telegra.ph/Khamis-02-19") ], [ InlineKeyboardButton( "Maana Ya Jihaad", url= "https://telegra.ph/Jihaad-Maana-Ya-Jihaad-Na-Kuwekewa-Shariah-01-24" ) ], [ InlineKeyboardButton("Khawaarij", url="https://telegra.ph/Khawaarij-04-16") ], [ InlineKeyboardButton( "Jihaad Ni Waajib", url="https://telegra.ph/Jihaad-Ni-Waajib-01-24") ], [ InlineKeyboardButton(
from pyrogram import Filters from nana import Command, app, AdminSettings from nana.helpers.aiohttp_helper import AioHttp from nana.helpers.PyroHelpers import msg __MODULE__ = "Nekobin" __HELP__ = """ ──「 **Paste to Nekobin** 」── -> `neko` Create a Nekobin paste using replied to message. """ @app.on_message(Filters.user(AdminSettings) & Filters.command("neko", Command)) async def paste(client, message): if message.reply_to_message: text = message.reply_to_message.text if message.reply_to_message.document and message.reply_to_message.document.file_size < 2 ** 20 * 10: var = os.path.splitext(message.reply_to_message.document.file_name)[1] print(var) path = await message.reply_to_message.download("nana/") with open(path, 'r') as doc: text = doc.read() os.remove(path) try: async with aiohttp.ClientSession() as session: async with session.post( 'https://nekobin.com/api/documents', json={"content": text},
if __name__ == "__main__" : # create download directory, if not exist if not os.path.isdir(DOWNLOAD_LOCATION): os.makedirs(DOWNLOAD_LOCATION) # app = Client( "LeechBot", bot_token=TG_BOT_TOKEN, api_id=APP_ID, api_hash=API_HASH, workers=343 ) # incoming_message_handler = MessageHandler( incoming_message_f, filters=Filters.command([f"{LEECH_COMMAND}"]) & Filters.chat(chats=AUTH_CHANNEL) ) app.add_handler(incoming_message_handler) # # incoming_gdrive_message_handler = MessageHandler( # incoming_gdrive_message_f, # filters=Filters.command([f"{GLEECH_COMMAND}"]) & Filters.chat(chats=AUTH_CHANNEL) # ) # app.add_handler(incoming_gdrive_message_handler) # # incoming_telegram_download_handler = MessageHandler( # down_load_media_f, # filters=Filters.command([f"{TELEGRAM_LEECH_COMMAND_G}"]) & Filters.chat(chats=AUTH_CHANNEL) # ) # app.add_handler(incoming_telegram_download_handler) #
`{}`""".format(message.from_user.id, message.from_user.first_name, str(e))) await asyncio.sleep(10) await no_admin_privilege_message.edit_text( text="https://t.me/c/1092696260/724970", disable_web_page_preview=True) else: await client.send_message(chat_id=message.chat.id, text="""<b>Automatic AntiFlooder</b> <a href='tg://user?id={}'>{}</a> has been automatically restricted because he reached the defined flood limit. #FLOOD""".format(message.from_user.id, message.from_user.first_name), reply_to_message_id=message.message_id) @Client.on_message(Filters.command("setflood", COMMAND_HAND_LER)) async def set_flood(_, message): """ /setflood command """ is_admin = await admin_check(message) if not is_admin: return if len(message.command) == 2: input_str = message.command[1] try: sql.set_flood(message.chat.id, input_str) global CHAT_FLOOD CHAT_FLOOD = sql.__load_flood_settings() await message.reply_text( "Antiflood updated to {} in the current chat".format(input_str)) except Exception as e: # pylint:disable=C0103,W0703 await message.reply_text(str(e))
# Update user's join status glovar.user_ids[uid]["join"][gid] = now save("user_ids") return True except Exception as e: logger.warning(f"Check join error: {e}", exc_info=True) finally: glovar.locks["message"].release() return False @Client.on_message(Filters.incoming & Filters.channel & ~Filters.command(glovar.all_commands, glovar.prefix) & hide_channel, group=-1) def exchange_emergency(client: Client, message: Message) -> bool: # Sent emergency channel transfer request try: # Read basic information data = receive_text_data(message) if not data: return True sender = data["from"] receivers = data["to"] action = data["action"] action_type = data["type"]
from pyrogram import Client, Filters from pyrogram.api import functions import config import os @Client.on_message(Filters.command("fake", prefixes = ['!','/'])) def fake(client,message): if message.from_user.id in config.sudos: text = message.text[6:] if message.reply_to_message: user_id = message.reply_to_message.from_user.id else: if text == '': user_id = client.get_me().id else: try: user_id = int(text) except: user_id = text cha = client.get_chat(user_id) if cha.type == 'private' or cha.type == 'bot': if cha.id == client.get_me().id: dat = config.personal_data text = 'No fake' else: text = 'new fake' if cha.description: description = cha.description[:69] else: description = '' if cha.last_name: