auto-renamer / plugins /user /callback.py
dragxd's picture
Final: Restore /myusage, remove /upgrade and all plan-related codes
ef51582
from pyrogram.types import (InlineKeyboardButton, InlineKeyboardMarkup)
from pyrogram import Client , filters
from script import *
from config import *
@Client.on_callback_query(filters.regex('about'))
async def about(bot,update):
text = script.ABOUT_TXT.format(bot.me.mention)
keybord = InlineKeyboardMarkup([
[InlineKeyboardButton("Back", callback_data="home", icon_custom_emoji_id=5433653135799228968)]
])
await update.message.edit(text = text,reply_markup = keybord)
@Client.on_message(filters.private & filters.command(["donate"]))
async def donatecm(bot,message):
text = script.DONATE_TXT
keybord = InlineKeyboardMarkup([
[InlineKeyboardButton("πŸ¦‹ Admin",url = "https://t.me/CallAdminRobot"),
InlineKeyboardButton("βœ–οΈ Close",callback_data = "cancel") ]])
await message.reply_text(text = text,reply_markup = keybord)
@Client.on_message(filters.private & filters.user(ADMIN) & filters.command(["admin"]))
async def admincm(bot,message):
text = script.ADMIN_TXT
keybord = InlineKeyboardMarkup([
[InlineKeyboardButton("βœ–οΈ Close βœ–οΈ",callback_data = "cancel") ]])
await message.reply_text(text = text,reply_markup = keybord)
@Client.on_callback_query(filters.regex('help'))
async def help(bot,update):
text = script.HELP_TXT.format(update.from_user.mention)
keybord = InlineKeyboardMarkup([
[InlineKeyboardButton('Thumbnail', callback_data='thumbnail', icon_custom_emoji_id=5375074927252621134),
InlineKeyboardButton('Caption', callback_data='caption', icon_custom_emoji_id=5316994101688677895)],
[InlineKeyboardButton('Home', callback_data='home', icon_custom_emoji_id=5433653135799228968)]
])
await update.message.edit(text = text,reply_markup = keybord)
@Client.on_callback_query(filters.regex('thumbnail'))
async def thumbnail(bot,update):
text = script.THUMBNAIL_TXT
keybord = InlineKeyboardMarkup([
[InlineKeyboardButton("πŸ”™ Back",callback_data = "help")]
])
await update.message.edit(text = text,reply_markup = keybord)
@Client.on_callback_query(filters.regex('^caption$'))
async def caption(bot,update):
text = script.CAPTION_TXT
keybord = InlineKeyboardMarkup([
[InlineKeyboardButton("πŸ”™ Back",callback_data = "help")]
])
await update.message.edit(text = text,reply_markup = keybord)
@Client.on_callback_query(filters.regex('home'))
async def home_callback_handler(bot, query):
text = f"""<emoji id="5316994101688677895">πŸ’Œ</emoji> <b>Welcome back, {query.from_user.mention}!</b>\n\n<emoji id="5985386442824619877">πŸš€</emoji> <i>Experience the next level of <b>Auto Renaming</b> with unmatched speed and precision.</i>\n\n<b><emoji id="5433653135799228968">πŸ“</emoji> High-End Features:</b>\n β€’ <b>Renaming</b> with custom metadata.\n β€’ <b>Thumbnail</b> management with ease.\n β€’ <b>Convert</b> between Files and Videos.\n β€’ <b>Fast</b> & Secure processing.\n\n<emoji id="5377834924776627189">⚑️</emoji> <i>Built for efficiency, designed for you.</i>\n\n<b>Bot Managed By @dragbotsupport</b>"""
buttons = [
[InlineKeyboardButton("Updates", url="https://t.me/dragbots", icon_custom_emoji_id=5985386442824619877),
InlineKeyboardButton("Support", url="https://t.me/dragbotsupport", icon_custom_emoji_id=5377834924776627189)],
[InlineKeyboardButton("Help", callback_data='help', icon_custom_emoji_id=5375074927252621134),
InlineKeyboardButton("About", callback_data='about', icon_custom_emoji_id=5224607267797606837)],
[InlineKeyboardButton("Stats", callback_data="stats", icon_custom_emoji_id=5042290883949495533)],
[InlineKeyboardButton("Developer", url="https://t.me/lungiiman", icon_custom_emoji_id=5985386442824619877)]
]
await query.message.edit_text(text=text, reply_markup=InlineKeyboardMarkup(buttons))
@Client.on_callback_query(filters.regex("^stats$"))
async def stats_callback_handler(bot, query):
from helper.database import botdata, find_one, total_user
from helper.progress import humanbytes
token = BOT_TOKEN
botid = token.split(':')[0]
botdata(int(botid))
data = find_one(int(botid))
total_rename = data["total_rename"]
total_size = data["total_size"]
stats_text = f"""<b>⚑️ Total User :</b> {total_user()}\n\n<b>⚑️ Total Renamed File :</b> {total_rename}\n<b>⚑ Total Size Renamed :</b> {humanbytes(int(total_size))}"""
await query.message.edit_text(
text=stats_text,
reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("πŸ”™ Back", callback_data="home")]])
)