async def download_media(bot, update): if update.from_user.id not in Config.AUTH_USERS: await bot.delete_messages(chat_id=update.chat.id, message_ids=update.message_id) a0 = await update.reply_text(text=Translation.NOT_AUTH_TXT) time.sleep(5) await a0.delete() await bot_settings(bot, update) raise StopPropagation() else: file_name = update.text extensions = Translation.EXTENSIONS if file_name.endswith(tuple(extensions)): if update.reply_to_message is not None: input_file_name[id] = file_name replied_message[id] = update.reply_to_message # ------------------ Asking for File Type Select Doc/Video ------------------# a = await bot.send_message( text=Translation.FILE_TYPE_SELECT.format(file_name), chat_id=update.chat.id, reply_to_message_id=update.message_id, reply_markup=InlineKeyboardMarkup([[ InlineKeyboardButton(text="📚Document", callback_data="rename_doc"), InlineKeyboardButton("🎞Video", callback_data="convert_video") ]])) message1[id] = a.message_id
async def set_admins(_, m: Message): """ handler function to promote / demote admins in the bot. (only for the CREATOR) :param _: pyrogram Client, unused argument :param m: the message. """ if not m.reply_to_message and len(m.command) == 2: uid = m.command[1] try: if not get_user(int(uid)): return _logger.debug("couldn't find a user") except ValueError: return _logger.debug("couldn't find a user, using wrong ID") elif not m.reply_to_message: return _logger.debug('not replayed to a message') else: uid = get_id(m) if not uid: return _logger.debug("couldn't find a user in the message") state = m.command[0] in COMMANDS['promote'] with db_session: get_user(uid).is_admin = state await m.reply( format_message('success_add_admin' if state else 'success_remove_admin', get_user(uid), lang=get_user(m.from_user.id).language )) raise StopPropagation()
async def start(bot, update): me = await bot.get_me() await bot.send_message( chat_id=update.chat.id, text=Translation.START_TEXT.format(update.from_user.first_name, me.first_name), parse_mode="html", disable_web_page_preview=True, reply_markup=InlineKeyboardMarkup( [ [InlineKeyboardButton("⚙️ Settings", callback_data="settings")] ]) ) await update.delete() raise StopPropagation()
async def send_start(bot, update): # logger.info(update) me = await bot.get_me() await bot.send_message( chat_id=update.chat.id, text=script.START_TEXT.format(update.from_user.first_name), reply_markup=InlineKeyboardMarkup( [[InlineKeyboardButton(text="Close", callback_data="close")]]), parse_mode="html", disable_web_page_preview=True, reply_to_message_id=update.message_id) await update.delete() raise StopPropagation()