11#(©)Codexbotz
2-
2+ import os
33import asyncio
44from pyrogram import Client , filters , __version__
5+ from pyrogram import Bot
56from pyrogram .types import Message , InlineKeyboardMarkup , InlineKeyboardButton
67from pyrogram .errors import FloodWait
78
89from bot import Bot
910from config import ADMINS , START_MSG , OWNER_ID , CUSTOM_CAPTION , DISABLE_CHANNEL_BUTTON
1011from helper_func import subscribed , encode , decode , get_messages
12+ from database .support import users_info
13+ from database .sql import add_user , query_msg
14+ ########₹₹₹₹#################₹#₹₹₹₹₹!₹###########₹₹₹₹₹₹₹₹##₹#####
15+ USERS_LIST = """<b>⭕️Total:</b>\n \n ⭕️Subscribers - {}\n ⭕️Blocked- {}"""
16+
17+ WAIT_MSG = """"<b>Processing ...</b>"""
1118
19+ REPLY_ERROR = """<code>Use this command as a replay to any telegram message with out any spaces.</code>"""
20+
21+ #########₹₹₹₹#################₹#₹₹₹₹₹!₹###########₹₹₹₹₹₹₹₹##₹#####
1222@Bot .on_message (filters .command ('start' ) & filters .private & subscribed )
1323async def start_command (client : Client , message : Message ):
1424 text = message .text
@@ -108,3 +118,50 @@ async def not_joined(client: Client, message: Message):
108118 quote = True ,
109119 disable_web_page_preview = True
110120 )
121+
122+ @Bot .on_message (filters .private & filters .command ('start' ))
123+ async def start_bot (bot , m : Message ):
124+ id = m .from_user .id
125+ user_name = '@' + m .from_user .username if m .from_user .username else None
126+ await add_user (id , user_name )
127+
128+
129+ @Bot .on_message (filters .private & filters .command ('users' ))
130+ async def subscribers_count (bot , m : Message ):
131+ id = m .from_user .id
132+ if id not in ADMINS :
133+ return
134+ msg = await m .reply_text (WAIT_MSG )
135+ messages = await users_info (bot )
136+ active = messages [0 ]
137+ blocked = messages [1 ]
138+ await m .delete ()
139+ await msg .edit (USERS_LIST .format (active , blocked ))
140+
141+
142+
143+ @Bot .on_message (filters .private & filters .command ('broadcast' ))
144+ async def send_text (bot , m : Message ):
145+ id = m .from_user .id
146+ if id not in ADMINS :
147+ return
148+ if (" " not in m .text ) and ("broadcast" in m .text ) and (m .reply_to_message is not None ):
149+ query = await query_msg ()
150+ for row in query :
151+ chat_id = int (row [0 ])
152+ try :
153+ await bot .copy_message (
154+ chat_id = chat_id ,
155+ from_chat_id = m .chat .id ,
156+ message_id = m .reply_to_message .message_id ,
157+ caption = m .caption ,
158+ reply_markup = m .reply_markup
159+ )
160+ except FloodWait as e :
161+ await asyncio .sleep (e .x )
162+ except Exception :
163+ pass
164+ else :
165+ msg = await m .reply_text (REPLY_ERROR , m .message_id )
166+ await asyncio .sleep (8 )
167+ await msg .delete ()
0 commit comments