Skip to content

Commit 20719c3

Browse files
authored
Some Feature Updated.
1 parent 9c2e421 commit 20719c3

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

Rkn_Bots/Caption.py

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# (c) @RknDeveloperr
22
# Rkn Developer
33
# Don't Remove Credit 😔
4-
# Telegram Channel @RknDeveloper & @Rkn_Bots
4+
# Telegram Channel @RknDeveloper & @Rkn_Botz
55
# Developer @RknDeveloperr
66

77
from pyrogram import Client, filters, errors, types
@@ -11,22 +11,27 @@
1111
from pyrogram.errors import FloodWait
1212

1313
@Client.on_message(filters.private & filters.user(Rkn_Bots.ADMIN) & filters.command(["rknusers"]))
14-
async def all_db_users_here(client,message):
15-
x = await message.reply_text("Please Wait....")
16-
total = await total_user()
17-
await x.edit(f"Tᴏᴛᴀʟ Usᴇʀ :- `{total}`")
14+
async def all_db_users_here(client, message):
15+
start_t = time.time()
16+
rkn = await message.reply_text("Processing...")
17+
uptime = time.strftime("%Hh%Mm%Ss", time.gmtime(time.time() - client.uptime))
18+
total_users = await total_user()
19+
end_t = time.time()
20+
time_taken_s = (end_t - start_t) * 1000
21+
await rkn.edit(text=f"**--Bot Processed--** \n\n**Bot Started UpTime:** {uptime} \n**Bot Current Ping:** `{time_taken_s:.3f} ᴍꜱ` \n**All Bot Users:** `{total_users}`")
22+
1823

1924
@Client.on_message(filters.private & filters.user(Rkn_Bots.ADMIN) & filters.command(["broadcast"]))
2025
async def broadcast(bot, message):
2126
if (message.reply_to_message):
22-
rkn = await message.reply_text("Geting All ids from database..\n Please wait")
27+
rkn = await message.reply_text("Bot Processing.\nI am checking all bot users.")
2328
all_users = await getid()
2429
tot = await total_user()
2530
success = 0
2631
failed = 0
2732
deactivated = 0
2833
blocked = 0
29-
await rkn.edit(f"ʙʀᴏᴀᴅᴄᴀsᴛɪɴɢ...")
34+
await rkn.edit(f"bot ʙʀᴏᴀᴅᴄᴀsᴛɪɴɢ started...")
3035
async for user in all_users:
3136
try:
3237
time.sleep(1)
@@ -48,12 +53,12 @@ async def broadcast(bot, message):
4853
await asyncio.sleep(t.x)
4954
await rkn.edit(f"<u>ʙʀᴏᴀᴅᴄᴀsᴛ ᴄᴏᴍᴘʟᴇᴛᴇᴅ</u>\n\n• ᴛᴏᴛᴀʟ ᴜsᴇʀs: {tot}\n• sᴜᴄᴄᴇssғᴜʟ: {success}\n• ʙʟᴏᴄᴋᴇᴅ ᴜsᴇʀs: {blocked}\n• ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs: {deactivated}\n• ᴜɴsᴜᴄᴄᴇssғᴜʟ: {failed}")
5055

51-
#Restart to cancell all process
56+
# Restart to cancell all process
5257
@Client.on_message(filters.private & filters.user(Rkn_Bots.ADMIN) & filters.command("restart"))
5358
async def restart_bot(b, m):
54-
msg = await b.send_message(text="**🔄 𝙿𝚁𝙾𝙲𝙴𝚂𝚂𝙴𝚂 𝚂𝚃𝙾𝙿𝙴𝙳. 𝙱𝙾𝚃 𝙸𝚂 𝚁𝙴𝚂𝚃𝙰𝚁𝚃𝙸𝙽𝙶...**", chat_id=m.chat.id)
59+
rkn_msg = await b.send_message(text="**🔄 𝙿𝚁𝙾𝙲𝙴𝚂𝚂𝙴𝚂 𝚂𝚃𝙾𝙿𝙴𝙳. 𝙱𝙾𝚃 𝙸𝚂 𝚁𝙴𝚂𝚃𝙰𝚁𝚃𝙸𝙽𝙶...**", chat_id=m.chat.id)
5560
await asyncio.sleep(3)
56-
await msg.edit("**✅️ 𝙱𝙾𝚃 𝙸𝚂 𝚁𝙴𝚂𝚃𝙰𝚁𝚃𝙴𝙳. 𝙽𝙾𝚆 𝚈𝙾𝚄 𝙲𝙰𝙽 𝚄𝚂𝙴 𝙼𝙴**")
61+
await rkn_msg.edit("**✅️ 𝙱𝙾𝚃 𝙸𝚂 𝚁𝙴𝚂𝚃𝙰𝚁𝚃𝙴𝙳. 𝙽𝙾𝚆 𝚈𝙾𝚄 𝙲𝙰𝙽 𝚄𝚂𝙴 𝙼𝙴**")
5762
os.execl(sys.executable, sys.executable, *sys.argv)
5863

5964
@Client.on_message(filters.command("start") & filters.private)
@@ -63,19 +68,19 @@ async def start_cmd(bot, message):
6368
await message.reply_photo(photo=Rkn_Bots.RKN_PIC,
6469
caption=f"<b>Hey, {message.from_user.mention}\n\nI'm an auto-caption bot. I automatically edit captions for videos, audio files, and documents posted on channels.\n\nuse <code>/set_caption</code> to set caption\nUse<code>/delcaption</code> To delete caption and set caption to default.\n\nNote:All commands works on channels only</b>",
6570
reply_markup=types.InlineKeyboardMarkup([[
66-
types.InlineKeyboardButton('Uᴩᴅᴀᴛᴇꜱ', url='https://t.me/RknDeveloper'),
67-
types.InlineKeyboardButton('Sᴜᴩᴩᴏʀᴛ', url='https://t.me/Rkn_Bots_Support')
71+
types.InlineKeyboardButton('Main Channel', url='https://t.me/RknDeveloper'),
72+
types.InlineKeyboardButton('Help Group', url='https://t.me/Rkn_Bots_Support')
6873
],[
6974
types.InlineKeyboardButton('🔥 Source Code 🔥', url='https://github.com/RknDeveloper/Rkn-AutoCaptionBot')
7075
]]))
7176

7277

73-
78+
# this command works on channels only
7479
@Client.on_message(filters.command("set_caption") & filters.channel)
75-
async def setCap(bot, message):
80+
async def setCaption(bot, message):
7681
if len(message.command) < 2:
7782
return await message.reply(
78-
"Usage: /set_caption <code>your caption (use {file_name} to show file name</code>)"
83+
"Exam.: /set_caption <code> set your caption ( use {file_name} to show file name</code>)"
7984
)
8085
chnl_id = message.chat.id
8186
caption = (
@@ -84,22 +89,23 @@ async def setCap(bot, message):
8489
chkData = await chnl_ids.find_one({"chnl_id": chnl_id})
8590
if chkData:
8691
await updateCap(chnl_id, caption)
87-
return await message.reply(f"Your New Caption: {caption}")
92+
return await message.reply(f"Successfully Updated Your Caption.\n\nYour New Caption: `{caption}`")
8893
else:
8994
await addCap(chnl_id, caption)
90-
return await message.reply(f"Your New Caption: {caption}")
95+
return await message.reply(f"Successfully Updated Your Caption.\n\nYour New Caption: `{caption}`")
9196

9297

98+
# this command works on channels only
9399
@Client.on_message(filters.command(["delcaption", "del_caption", "delete_caption"]) & filters.channel)
94-
async def delCap(_, msg):
100+
async def delCaption(_, msg):
95101
chnl_id = msg.chat.id
96102
try:
97103
await chnl_ids.delete_one({"chnl_id": chnl_id})
98-
return await msg.reply("<b>Success..From now i will use my default caption</b>")
104+
return await msg.reply("<b>Successfully deleted your caption..From now i will use my default caption</b>")
99105
except Exception as e:
100-
e_val = await msg.replay(f"ERR I GOT: {e}")
106+
rkn = await msg.reply(f"Error: {e}")
101107
await asyncio.sleep(5)
102-
await e_val.delete()
108+
await rkn.delete()
103109
return
104110

105111

@@ -132,5 +138,5 @@ async def auto_edit_caption(bot, message):
132138

133139
# Rkn Developer
134140
# Don't Remove Credit 😔
135-
# Telegram Channel @RknDeveloper & @Rkn_Bots
141+
# Telegram Channel @RknDeveloper & @Rkn_Botz
136142
# Developer @RknDeveloperr

0 commit comments

Comments
 (0)