import os import time if bool(os.environ.get("ENV", False)): from sample_config import Config else: from config import Config from translation import Translation from pyrogram import Client, filters as Filters from bot import channel, channel_name # ******************************** CONFIGURING DEFAULT SENDING CHANNEL USING COMMANDS *********************************# @Client.on_message(Filters.private & Filters.command(["channel1"])) async def channel1(bot, update): if update.from_user.id not in Config.AUTH_USERS: await bot.delete_messages(chat_id=update.chat.id, message_ids=update.message_id) a = await update.reply_text(text=Translation.NOT_AUTH_TXT) time.sleep(5) await a.delete() return channel_id = Config.CHANNEL1_ID channel_string = Config.CHANNEL1_NAME if not channel_id: await bot.delete_messages(chat_id=update.chat.id, message_ids=update.message_id) a = await bot.send_message(chat_id=update.chat.id, text=Translation.INVALID_CHANNEL) time.sleep(10)
from pyrogram import Client, filters from configs import Config from core.handlers.main_db_handler import db from core.display_progress import progress_for_pyrogram, humanbytes from core.handlers.force_sub_handler import handle_force_subscribe from core.handlers.upload_video_handler import send_video_handler from core.handlers.broadcast_handlers import broadcast_handler from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery from pyrogram.errors.exceptions.flood_420 import FloodWait from pyrogram.errors.exceptions.bad_request_400 import UserNotParticipant, MessageNotModified AHBot = Client(Config.BOT_USERNAME, bot_token=Config.BOT_TOKEN, api_id=Config.API_ID, api_hash=Config.API_HASH) @AHBot.on_message(filters.command(["start", "help"]) & filters.private) async def HelpWatermark(bot, cmd): if not await db.is_user_exist(cmd.from_user.id): await db.add_user(cmd.from_user.id) await bot.send_message( Config.LOG_CHANNEL, f"#NEW_USER: \n\nNew User [{cmd.from_user.first_name}](tg://user?id={cmd.from_user.id}) started @{Config.BOT_USERNAME} !!" ) if Config.UPDATES_CHANNEL: await handle_force_subscribe(bot, cmd) await cmd.reply_text( text=Config.USAGE_WATERMARK_ADDER, parse_mode="Markdown", reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("Developer", url="https://t.me/Royal_Devendra"), InlineKeyboardButton("💬Support Group", url="https://t.me/SunShineBotsChat")], [InlineKeyboardButton("🤖Bots Channel", url="https://t.me/SunShineBots")]]), disable_web_page_preview=True )
from pyrogram import filters from ..config import Config from ..screenshotbot import ScreenShotBot @ScreenShotBot.on_message(filters.private & filters.command("set_watermark")) async def _(c, m): if not await c.db.is_user_exist(m.chat.id): await c.db.add_user(m.chat.id) await c.send_message( Config.LOG_CHANNEL, f"New User [{m.from_user.first_name}](tg://user?id={m.chat.id}) started." ) if len(m.command) == 1: await m.reply_text( text= "You can add custom watermark text to the screenshots.\n\nUsage: `/set_watermark text`. Text should not Exceed 30 characters.", quote=True, parse_mode="markdown") return watermark_text = ' '.join(m.command[1:]) if len(watermark_text) > 30: await m.reply_text( text= f"The watermark text you provided (__{watermark_text}__) is `{len(watermark_text)}` characters long! You cannot set watermark text greater than 30 characters.", quote=True, parse_mode="markdown")
from callsmusic.callsmusic import client as USER from pyrogram import Client, filters from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup from pyrogram.errors import UserAlreadyParticipant from helpers.decorators import errors, authorized_users_only @Client.on_message(filters.group & filters.command(["userbotjoin"])) @authorized_users_only @errors async def addchannel(client, message): chid = message.chat.id try: invitelink = await client.export_chat_invite_link(chid) except: await message.reply_text( "<b>Jadikan Saya Sebagai Admin Di grup Anda.</b>", ) return try: user = await USER.get_me() except: user.first_name = "RANDOM MUSIK" try: await USER.join_chat(invitelink) await USER.send_message(message.chat.id,"Saya Bergabung di Grup anda") except UserAlreadyParticipant: await message.reply_text( "<b>@asistan_random Suda Siap Dalam Chat</b>", )
client=app, input_filename="input.raw", play_on_repeat=True, enable_logs_to_console=False, ) # Arq Client arq = ARQ(ARQ_API) async def delete(message): await asyncio.sleep(10) await message.delete() @app.on_message(filters.command("start") & filters.chat(SUDO_CHAT_ID)) async def start(_, message): await send(START_TEXT) @app.on_message(filters.command("help") & filters.chat(SUDO_CHAT_ID)) async def help(_, message): await send(HELP_TEXT) @app.on_message(filters.command("repo") & filters.chat(SUDO_CHAT_ID)) async def repo(_, message): await send(REPO_TEXT) @app.on_message(filters.command("joinvc") & filters.user(SUDOERS))
# and is released under the "GNU v3.0 License Agreement". # Please see < https://github.com/Userge-Assistant/blob/master/LICENSE > # # All rights reserved. import os import aiohttp from aiohttp import ClientResponseError, ServerTimeoutError, TooManyRedirects from assistant import Config, bot, cus_filters from pyrogram import filters from pyrogram.types import Message NEKOBIN_URL = "https://nekobin.com/" @bot.on_message(filters.command("paste") & cus_filters.auth_chats) async def nekobin_paste(_, message: Message): """ Pastes the text directly to Nekobin """ cmd = len(message.text) msg = await message.reply("`Processing...`") text = None if message.text and cmd > 6: _, args = message.text.split(maxsplit=1) text = args replied = message.reply_to_message file_ext = '.txt' if not cmd > 6 and replied and replied.document and replied.document.file_size < 2 ** 20 * 10: file_ext = os.path.splitext(replied.document.file_name)[1] path = await replied.download("downloads/") with open(path, 'r') as d_f: text = d_f.read()
await message.reply_text( _("more_than_one_args") ) else: stream = player.stream( args[1], [ client.send_message, [ LOG_GROUP, _("group_log_stream").format( args[1] ) ] ] if LOG_GROUP else None ) await message.reply_text( _("streaming") ) __handlers__ = [ [ MessageHandler( stream, filters.command("stream", "/") & SUDO_FILTER ) ] ]
from pyrogram import Client, filters from pyrogram.types import Message import tgcalls from converter import convert from youtube import download import sira from config import DURATION_LIMIT from helpers.wrappers import errors from helpers.errors import DurationLimitError @Client.on_message(filters.command("play") & filters.private & ~filters.edited) async def play_(client: Client, message: Message): await message.reply_text( "**itznik_x:** Sorry! I can only be used in groups. \nTry again in a group." ) @Client.on_message(filters.command("play") & filters.group & ~filters.edited) @errors async def play(client: Client, message_: Message): audio = (message_.reply_to_message.audio or message_.reply_to_message.voice ) if message_.reply_to_message else None res = await message_.reply_text("**itznik_x:** 🔄 Processing...") if audio: if round(audio.duration / 60) > DURATION_LIMIT: raise DurationLimitError( f"**itznik_x:** Videos longer than {DURATION_LIMIT} minute(s) aren't allowed, the provided video is {audio.duration / 60} minute(s)"
async def check_gmute(client, message): user_id = message.from_user.id if user_id in SUDO or user_id in OWNER: return mention = message.from_user.mention chat_id = message.chat.id check = sql.check_gmute(user_id) admin_list = [] all = client.iter_chat_members(chat_id, filter="administrators") admin_list = [] async for admin in all: admin_list.append(admin.user.id) if user_id in admin_list: return if check: text = "User {} ada daftar global mute dan telah di bisukan!".format( mention) if check.reason: text += "\nAlasan : {}".format(reason) await client.restrict_chat_member(chat.chat_id, user_id, ChatPermissions()) await client.send_message(chat_id, text) AddHandler(gban, filters.group & filters.command("gban", Command)) AddHandler(ungban, filters.group & filters.command("ungban", Command)) AddHandler(gmute, filters.group & filters.command("gmute", Command)) AddHandler(ungmute, filters.group & filters.command("ungmute", Command))
from alita import PREFIX_HANDLER from alita.__main__ import Alita from pyrogram import filters from pyrogram.types import Message __PLUGIN__ = "Wikipedia" __help__ = """ Search Wikipedia on the go in your group! **Available commands:** • /wiki <query>: wiki your query. """ @Alita.on_message(filters.command("wiki", PREFIX_HANDLER)) async def wiki(c: Alita, m: Message): if m.reply_to_message: search = m.reply_to_message.text else: search = m.text.split(None, 1)[1] try: res = wikipedia.summary(search) except DisambiguationError as de: await m.reply_text( f"Disambiguated pages found! Adjust your query accordingly.\n<i>{de}</i>", parse_mode="html", ) return except PageError as pe: await m.reply_text(f"<code>{pe}</code>", parse_mode="html")
api_id=2443183, api_hash="66b6799e1b784aff78bad680cd8362db", ) blacklisted = [] mode = None async def getresp(query): url = f"https://lunabot.tech/?query={query}" async with aiohttp.ClientSession() as session: async with session.get(url) as res: res = await res.json() text = res["response"] return text @luna.on_message(filters.command("repo") & ~filters.edited) async def repo(_, message): await message.reply_text( "[Github](https://github.com/thehamkercat/LunaChatBot)" + " | [Group](t.me/PatheticProgrammers)", disable_web_page_preview=True) @luna.on_message(filters.command("help") & ~filters.edited) async def start(_, message): user_id = message.from_user.id if user_id in blacklisted: return await luna.send_chat_action(message.chat.id, "typing") await message.reply_text( "**Only For Owners**\n/shutdown - `Shutdown Luna.`\n/blacklist - `Blacklist A User.`\n/whitelist - `Whitelist A User.`" )
import os import html import tempfile from pyrogram import Client, filters from .. import config, help_dict, log_errors, session, progress_callback, public_log_errors @Client.on_message(~filters.forwarded & ~filters.sticker & ~filters.via_bot & ~filters.edited & filters.me & filters.command('cat', prefixes=config['config']['prefixes'])) @log_errors @public_log_errors async def cat(client, message): media = (message.text or message.caption).markdown.split(' ', 1)[1:] if media: media = os.path.expanduser(media[0]) else: media = message.document if not media and not getattr(message.reply_to_message, 'empty', True): media = message.reply_to_message.document if not media: await message.reply_text('Document or local file path required') return done = False reply = rfile = None try: if not isinstance(media, str): rfile = tempfile.NamedTemporaryFile() reply = await message.reply_text('Downloading...') await client.download_media(media, file_name=rfile.name, progress=progress_callback, progress_args=(reply, 'Downloading...', False)) media = rfile.name with open(media, 'rb') as file: while True: chunk = file.read(4096)
from pyrogram import Client, filters, emoji from main import prefixes from methods.Bing import Bing Bing = Bing() @Client.on_message(filters.me & filters.command("search", prefixes=prefixes)) def search_command(c, msg): msg.edit_text("Searching...") if len(msg.command) < 2: msg.edit_text("Please use <code>/search Your Keywords</code>") return 0 results = Bing.search(" ".join(msg.command[1:])) if results: message = "{} Search {}\n\n".format(emoji.GLOBE_WITH_MERIDIANS, emoji.GLOBE_WITH_MERIDIANS) for r in results: message += f'{emoji.MINUS} <a href="{r[0]}">{r[1]}</a>\n' msg.edit_text(message, disable_web_page_preview=True) else: msg.edit_text("Nothing Found")
fixed_memes_help = [] for meme in memes_data: memes.append(meme) if "alts" in memes_data[meme]: for y in memes_data[meme]["alts"]: memes.append(y) # Construct the help from the same loop eh. command = f".{meme}" if "alts" in memes_data[meme]: for y in memes_data[meme]["alts"]: command += f" __or__ .{y}" fixed_memes_help.append([command, memes_data[meme]["help"]]) @UserBot.on_message(filters.command(memes, ".") & filters.me) async def fixed_memes(_, message: Message): await message.delete() cmd = message.command[0] if cmd not in memes_data: for x in memes_data: if "alts" in memes_data[x] and cmd in memes_data[x]["alts"]: the_meme = memes_data[x] break else: the_meme = memes_data[message.command[0]] if the_meme["type"] == "animation": await send_saved_animation( message, the_meme["name"], the_meme["image"], caption=the_meme["caption"]
import aiofiles import aiohttp import wget from pyrogram import Client, filters from pyrogram.errors import FloodWait, MessageNotModified from pyrogram.types import Message, InlineKeyboardButton, InlineKeyboardMarkup from youtubesearchpython import SearchVideos import yt_dlp from youtube_search import YoutubeSearch import requests def time_to_seconds(time): stringt = str(time) return sum(int(x) * 60 ** i for i, x in enumerate(reversed(stringt.split(':')))) @Client.on_message(filters.command(["song"]) & ~filters.channel & ~filters.edited) def a(update, message): query = '' for i in message.command[1:]: query += ' ' + str(i) print(query) m = message.reply("**🎵 Processing**") ydl_opts = { "format": "bestaudio", "key": "FFmpegMetadata", "prefer_ffmpeg": True, "geo_bypass": True, "nocheckcertificate": True, "postprocessors": [ { "key": "FFmpegExtractAudio",
from datetime import datetime from pyrogram import errors, filters from pyrogram.types import Message from alita import LOGGER, MESSAGE_DUMP, PREFIX_HANDLER, SUPPORT_GROUP, SUPPORT_STAFF from alita.bot_class import Alita from alita.db import antispam_db as db from alita.utils.custom_filters import sudo_filter from alita.utils.extract_user import extract_user from alita.utils.parser import mention_html @Alita.on_message(filters.command(["gban", "globalban"], PREFIX_HANDLER) & sudo_filter) async def gban(c: Alita, m: Message): if len(m.text.split()) == 1: await m.reply_text("<b>How to gban?</b>\n<b>Answer:</b> `/gban user_id reason`") return if len(m.text.split()) == 2 and not m.reply_to_message: await m.reply_text("Please enter a reason to gban user!") return user_id, user_first_name = await extract_user(m) me = await c.get_me() if m.reply_to_message: gban_reason = m.text.split(None, 1)[1]
# Eval and Sh module from nana-remix async def aexec(code, client, message): exec("async def __aexec(client, message): " + "".join(f"\n {a}" for a in code.split("\n"))) return await locals()["__aexec"](client, message) async def edit_or_reply(msg: Message, **kwargs): func = msg.edit_text if msg.from_user.is_self else msg.reply spec = getfullargspec(func.__wrapped__).args await func(**{k: v for k, v in kwargs.items() if k in spec}) @app.on_message( filters.user(OWNER_ID) & ~filters.forwarded & ~filters.via_bot & filters.command("eval")) async def executor(client, message): try: cmd = message.text.split(" ", maxsplit=1)[1] except IndexError: await message.delete() return 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 = StringIO() redirected_error = sys.stderr = StringIO() stdout, stderr, exc = None, None, None try:
from pyrogram import Client, filters from pyrogram.types import Message from .utils.utils import modules_help from .utils.utils import requirements_list # packages from PyPi #import example_1 #import example_2 @Client.on_message(filters.command('example_edit', ['.']) & filters.me) async def example_edit(client: Client, message: Message): await message.edit('<code>This is an example module</code>') @Client.on_message(filters.command('example_send', ['.']) & filters.me) async def example_send(client: Client, message: Message): await client.send_message(message.chat.id, '<b>This is an example module</b>') # This adds instructions for your module modules_help.update({ 'example': '''example_send - example send, example_edit - example edit''', 'example module': 'Example: example_send, example_edit' }) #'module_name': '''comand_1 - description, comand_2 - description''', # │ 'module_name module': 'Example send: example_send, example_edit\n\n' # │ │ │ # │ │ │
async def get_current_layout(text: str) -> str: layouts = {} for key, value in LAYOUTS.items(): layouts[len([v for v in text if v in value])] = key return layouts[max(layouts.keys())] async def change_keyboard_layout(text: str, from_layout: str, to_layout: str) -> str: table = str.maketrans(from_layout, to_layout) return text.translate(table) @Client.on_message(filters.me & filters.command("layout", prefixes=".")) @doc_args("language code") async def layout_command(client: Client, message: Message): """ Change the keyboard layout of a message. The language code is <b>optional</b>. If the message is yours, it will be edited. If the message isn't yours, the new one will be sent. <b>Example of the command in action:</b> <code>Ghbdtn</code> >> <code>Привет</code>. """ if not message.reply_to_message: await message.edit_text( "You must reply to a message to change its layout.") text = message.reply_to_message.text or message.reply_to_message.caption entities = message.reply_to_message.entities or message.reply_to_message.caption_entities current_layout = LAYOUTS[await get_current_layout(text)]
import os from asyncio import sleep from pyrogram import filters from removebg import RemoveBg from nana import app, Command, remove_bg_api, AdminSettings, edrep from nana.helpers.PyroHelpers import ReplyCheck DOWN_PATH = 'nana/' IMG_PATH = DOWN_PATH + "image.jpg" @app.on_message(filters.user(AdminSettings) & filters.command("rmbg", Command)) async def remove_bg(client, message): if not remove_bg_api: await edrep( message, text= "Get the API from [Remove.bg](https://www.remove.bg/b/background-removal-api)", disable_web_page_preview=True, parse_mode="html") replied = message.reply_to_message if (replied and replied.media and (replied.photo or (replied.document and "image" in replied.document.mime_type))): if os.path.exists(IMG_PATH): os.remove(IMG_PATH) await client.download_media(message=replied, file_name=IMG_PATH)
from pyrogram import filters import asyncio @app.on_message(filters.text, group=global_stats_group) @capture_err async def chat_watcher(_, message): chat_id = message.chat.id served_chat = await is_served_chat(chat_id) if served_chat: return await add_served_chat(chat_id) @app.on_message( filters.command("gstats") & filters.user(SUDOERS) & ~filters.edited) @capture_err async def global_stats(_, message): m = await app.send_message(message.chat.id, text="__**Analysing Stats**__", disable_web_page_preview=True) # For bot served chat and users count served_chats = [] total_users = 0 chats = await get_served_chats() for chat in chats: served_chats.append(int(chat["chat_id"])) await m.edit( f"__**Analysing Stats Might Take {len(served_chats)*6}+ Seconds.**__",
from pyrogram import filters from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup from ..customClient import customClient # Broadcast Command @customClient.on_message(filters.command("broadcast") & filters.private) async def broadcastCommand(client : customClient, m): if client.is_admin(m) and m.reply_to_message: message = m.reply_to_message buttons = InlineKeyboardMarkup( [ [ InlineKeyboardButton("Fissa ❌", callback_data="Fix false"), InlineKeyboardButton("Notifica ❌", callback_data="Notifica false") ], [ InlineKeyboardButton("Send Broadcast Msg", callback_data="sendToAll") ] ] ) if message.photo: await client.send_photo( message.chat.id, photo=message.photo.file_id, file_ref=message.photo.file_ref, caption=message.caption.html, reply_markup=buttons ) else: await client.send_message( message.chat.id, text = message.text.html,
from pyrogram import filters from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton from ..screenshotbot import ScreenShotBot @ScreenShotBot.on_message(filters.private & filters.command("start")) async def start(c, m): await m.reply_text( text= f"Hi there {m.from_user.mention}.\n\nI'm Screenshot Generator Bot. I can provide screenshots from " "your video files without downloading the entire file (almost instantly). For more details check /help.", quote=True, reply_markup=InlineKeyboardMarkup([ [ InlineKeyboardButton("Source 😒", url="https://t.me/CerminGroup"), InlineKeyboardButton("Project Channel", url="https://t.me/CerminGroup"), ], [InlineKeyboardButton("My Owner", url="https://t.me/Beyaaaan")], ]), )
InlineKeyboardButton( 'Airing', switch_inline_query_current_chat='airing '), InlineKeyboardButton('Character', switch_inline_query_current_chat='char '), ]] @dankbot.on_callback_query(callback_data(['help'])) @capture_err async def chelp(_, client): await client.edit_message_text( 'Available cmds for now :\n /animeinfo - search anime on AniList\n /mangainfo - search manga on Anilist\n /charinfo - search character on Anilist\n /airinfo - check airing status of an anime\n /wa by replying to a media - find what anime a media is from\n /nhentai ID - returns the nhentai in telegraph instant preview format.', reply_markup=InlineKeyboardMarkup(buttons)) @dankbot.on_message(~filters.me & filters.command('help', prefixes='/'), group=8) @capture_err async def help(_, message): buttons = [ [ InlineKeyboardButton('Anime', switch_inline_query_current_chat='anime '), InlineKeyboardButton('Manga', switch_inline_query_current_chat='manga '), InlineKeyboardButton('nHentai', switch_inline_query_current_chat='nhentai ') ], [ InlineKeyboardButton('Airing', switch_inline_query_current_chat='airing '),
"""download from 1134 websites /ytdl""" import os from pyrogram import (Client, filters) from pyrobot import (COMMAND_HAND_LER, TMP_DOWNLOAD_DIRECTORY) from pyrobot.helper_functions.cust_p_filters import sudo_filter from pyrobot.helper_functions.you_tube_dl_extractor import ( extract_youtube_dl_formats) from pyrobot.helper_functions.extract_link import extract_link @Client.on_message(filters.command("ytdl", COMMAND_HAND_LER) & sudo_filter) async def down_load_media(client, message): status_message = await message.reply_text("...", quote=True) current_user_id = message.from_user.id # create an unique directory user_working_dir = os.path.join(TMP_DOWNLOAD_DIRECTORY, str(current_user_id)) # create download directory, if not exist if not os.path.isdir(user_working_dir): os.makedirs(user_working_dir) assumed_url, _, _, _ = extract_link(message.reply_to_message) # list the formats, and display in button markup formats thumb_image, text_message, reply_markup = await extract_youtube_dl_formats( assumed_url, user_working_dir) if thumb_image is not None: await message.reply_photo(photo=thumb_image,
[ InlineKeyboardButton( "Documentation", url="https://aman-a.gitbook.io/nana-remix/" ) ], [ InlineKeyboardButton( "Repository", url="https://github.com/pokurt/Nana-Remix" ), InlineKeyboardButton("Support", url="https://t.me/nanabotsupport"), ], ] await message.reply(msg, reply_markup=InlineKeyboardMarkup(buttons)) @setbot.on_message(filters.user(AdminSettings) & filters.command(["start"])) async def start(_client, message): if message.chat.type != 'private': await message.reply('henlo ^0^') else: if len(message.text.split()) >= 2: helparg = message.text.split()[1] if helparg == "help_inline": await message.reply(tld("inline_help_text").format(BotUsername)) return try: me = await app.get_me() except ConnectionError: me = None userbot_stat = 'Stopped' if not me else 'Running' db_stat = len(get_all_chats()) if DB_AVAILABLE else 'None'
draw.text((205, 550), f"Title: {title}", (51, 215, 255), font=font) draw.text((205, 590), f"Duration: {duration}", (255, 255, 255), font=font) draw.text((205, 630), f"Views: {views}", (255, 255, 255), font=font) draw.text( (205, 670), f"Added By: {requested_by}", (255, 255, 255), font=font, ) img.save("final.png") os.remove("temp.png") os.remove("background.png") @Client.on_message( filters.command("playlist") & filters.group & ~filters.edited) async def playlist(client, message): global que queue = que.get(message.chat.id) if not queue: await message.reply_text("Player is idle") temp = [] for t in queue: temp.append(t) now_playing = temp[0][0] by = temp[0][1].mention(style="md") msg = "**Now Playing** in {}".format(message.chat.title) msg += "\n- " + now_playing msg += "\n- Req by " + by temp.pop(0) if temp:
draw.text((205, 550), f"Title: {title}", (51, 215, 255), font=font) draw.text((205, 590), f"Duration: {duration}", (255, 255, 255), font=font) draw.text((205, 630), f"Views: {views}", (255, 255, 255), font=font) draw.text( (205, 670), f"Added By: {requested_by}", (255, 255, 255), font=font, ) img.save("final.png") os.remove("temp.png") os.remove("background.png") @Client.on_message( filters.command("playlist") & filters.group & ~filters.edited) async def playlist(client, message): global que queue = que.get(message.chat.id) if not queue: await message.reply_text('Player is idle') temp = [] for t in queue: temp.append(t) now_playing = temp[0][0] by = temp[0][1].mention(style='md') msg = "**Now Playing** in {}".format(message.chat.title) msg += "\n- " + now_playing msg += "\n- Req by " + by
from pyrogram import Client, filters, emoji from pyrogram.methods.messages.download_media import DEFAULT_DOWNLOAD_DIR from pyrogram.types import Message from VOIP.filters import main_filter, self_or_contact_filter from VOIP.voice import mp from handlers.ryuk.shinigami import current_vc from handlers.ryuk.shinigami import PLAYING_HELP from handlers.ryuk.shinigami import RM_TIME @Client.on_message(main_filter & self_or_contact_filter & current_vc & filters.command("skip", prefixes=".")) async def skip_track(_, m: Message): playlist = mp.playlist if len(m.command) == 1: await mp.skip_current_playing() else: try: items = list(dict.fromkeys(m.command[1:])) items = [int(x) for x in items if x.isdigit()] items.sort(reverse=True) text = [] for i in items: if 2 <= i <= (len(playlist) - 1): audio = f"[{playlist[i].audio.title}]({playlist[i].link})" playlist.pop(i) text.append(f"{emoji.WASTEBASKET} {i}. **{audio}**")
def command(commands: Union[str, List[str]]): return filters.command(commands, COMMAND_PREFIXES)