MCPcopy Create free account
hub / github.com/TechifyBots/Rename-Bot / cb_handler

Function cb_handler

plugins/start_and_cb.py:198–353  ·  view source on GitHub ↗
(client, query: CallbackQuery)

Source from the content-addressed store, hash-verified

196
197@Client.on_callback_query()
198async def cb_handler(client, query: CallbackQuery):
199 data = query.data
200 if data == "start":
201 start_button = [[
202 InlineKeyboardButton('ᴀʙᴏᴜᴛ', callback_data='about'),
203 InlineKeyboardButton('ʜᴇʟᴘ', callback_data='help')
204 ]]
205 if client.premium:
206 start_button.append([InlineKeyboardButton('💸 ᴜᴘɢʀᴀᴅᴇ ᴛᴏ ᴘʀᴇᴍɪᴜᴍ 💸', callback_data='upgrade')])
207 await query.message.edit_text(
208 text=rkn.START_TXT.format(query.from_user.mention),
209 disable_web_page_preview=True,
210 reply_markup = InlineKeyboardMarkup(start_button))
211
212 elif data == "help":
213 await query.message.edit_text(
214 text=rkn.HELP_TXT,
215 disable_web_page_preview=True,
216 reply_markup=InlineKeyboardMarkup([[
217 #⚠️ don't change source code & source link ⚠️ #
218 InlineKeyboardButton("ᴛʜᴜᴍʙɴᴀɪʟ", callback_data = "thumbnail"),
219 InlineKeyboardButton("ᴄᴀᴘᴛɪᴏɴ", callback_data = "caption")
220 ],[
221 InlineKeyboardButton("ꜰɪʟᴇ ɴᴀᴍᴇ", callback_data = "custom_file_name"),
222 InlineKeyboardButton("ᴍᴇᴛᴀᴅᴀᴛᴀ", callback_data = "digital_meta_data")
223 ],[
224 InlineKeyboardButton("ʙᴀᴄᴋ", callback_data = "start")
225 ]]))
226
227 elif data == "about":
228 about_button = [[
229 #⚠️ don't change source code & source link ⚠️ #
230 InlineKeyboardButton("sᴏᴜʀᴄᴇ", callback_data = "source_code"), #Whoever is deploying this repo is given a warning ⚠️ not to remove this repo link #first & last warning ⚠️
231 InlineKeyboardButton("ʙᴏᴛ sᴛᴀᴛᴜs", callback_data = "bot_status")
232 ],[
233 InlineKeyboardButton("ʟɪᴠᴇ sᴛᴀᴛᴜs", callback_data = "live_status")
234 ]]
235 if client.premium:
236 about_button[-1].append(InlineKeyboardButton("ᴜᴘɢʀᴀᴅᴇ", callback_data = "upgrade"))
237 about_button.append([InlineKeyboardButton("ʙᴀᴄᴋ", callback_data = "start")])
238 else:
239 about_button[-1].append(InlineKeyboardButton("ʙᴀᴄᴋ", callback_data = "start"))
240 await query.message.edit_text(
241 text=rkn.ABOUT_TXT.format(client.mention, __developer__, __programer__, __library__, __language__, __database__, _bot_version_),
242 disable_web_page_preview = True,
243 reply_markup=InlineKeyboardMarkup(about_button))
244
245 elif data == "upgrade":
246 if not client.premium:
247 return await query.message.delete()
248 user = query.from_user
249 upgrade_msg = rkn.UPGRADE_PLAN.format(user.mention) if client.uploadlimit else rkn.UPGRADE_PREMIUM.format(user.mention)
250 free_trial_status = await digital_botz.get_free_trial_status(query.from_user.id)
251 if not await digital_botz.has_premium_access(query.from_user.id):
252 if not free_trial_status:
253 await query.message.edit_text(text=upgrade_msg, disable_web_page_preview=True, reply_markup=upgrade_trial_button)
254 else:
255 await query.message.edit_text(text=upgrade_msg, disable_web_page_preview=True, reply_markup=upgrade_button)

Callers

nothing calls this directly

Calls 7

humanbytesFunction · 0.90
upload_docFunction · 0.90
get_free_trial_statusMethod · 0.80
has_premium_accessMethod · 0.80
give_free_trialMethod · 0.80
total_users_countMethod · 0.80

Tested by

no test coverage detected