From c9144f7b93b179d2db71bb44274ddc80e4a4bf76 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Sun, 14 Nov 2021 19:10:12 +0700 Subject: [PATCH] not now --- program/broadcast.py | 59 -------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 program/broadcast.py diff --git a/program/broadcast.py b/program/broadcast.py deleted file mode 100644 index 3407600..0000000 --- a/program/broadcast.py +++ /dev/null @@ -1,59 +0,0 @@ -from io import BytesIO -from pyrogram.types import Message -from pyrogram import Client, filters - -from config import BOT_USERNAME -from driver.filters import command -from driver.decorators import sudo_users_only, get_arg -from driver.database.data_sql import chatdata, del_chat - - -@Client.on_message( - command(["broadcast", f"broadcast@{BOT_USERNAME}"]) & filters.private & ~filters.edited -) -@sudo_users_only -async def broadcast(client: Client, message: Message): - to_send = get_arg(message) - success = 0 - failed = 0 - for chat in chatdata()(): - try: - await client.send_message( - str(chat), - to_send - ) - success += 1 - except BaseException: - failed += 1 - del_chat(str(chat)) - await message.reply( - f"Message sent to {success} chat(s). {failed} chat(s) failed recieve message" - ) - - -@Client.on_message( - command(["chatlist", f"chatlist@{BOT_USERNAME}"]) & filters.private & ~filters.edited -) -@sudo_users_only -async def chatlist(client, message): - all_chats = chatdata() - chats = [i for i in all_chats if str(i).startswith("-")] - chatfile = "Chat List.\n0. Group ID | Members | Invite Link\n" - P = 1 - for chat in chats: - try: - link = await client.export_chat_invite_link(int(chat)) - except BaseException: - link = "Null" - try: - members = await client.get_chat_members_count(int(chat)) - except BaseException: - members = "Null" - try: - chatfile += f"{P}. {chat} | {members} | {link}\n" - P += 1 - except BaseException: - pass - with BytesIO(str.encode(chatfile)) as output: - output.name = "chatlist.txt" - await message.reply_document(document=output, disable_notification=True)