async def inline_handler(event): z = [] PLUGINS = HELP["Official"] if "Official" in HELP.keys() else [] ADDONS = HELP["Addons"] if "Addons" in HELP.keys() else [] for x in LIST.values(): for y in x: z.append(y) text = get_string("inline_4").format( OWNER_NAME, len(PLUGINS), len(ADDONS), len(z), ) if INLINE_PIC: result = await event.builder.photo( file=INLINE_PIC, link_preview=False, text=text, buttons=_main_help_menu, ) else: result = await event.builder.article( title="Ultroid Help Menu", text=text, buttons=_main_help_menu ) await event.answer([result], gallery=True)
async def setting(event): z = [] for x in LIST.values(): z.extend(x) await event.edit( get_string("inline_4").format( OWNER_NAME, len(HELP.get("Official", [])), len(HELP.get("Addons", [])), len(z), ), file=INLINE_PIC, link_preview=False, buttons=[ [ Button.inline("•Pɪɴɢ•", data="pkng"), Button.inline("•Uᴘᴛɪᴍᴇ•", data="upp"), ], [ Button.inline("•Stats•", data="alive"), Button.inline("•Uᴘᴅᴀᴛᴇ•", data="doupdate"), ], [Button.inline("« Bᴀᴄᴋ", data="open")], ], )
async def setting(event): z = [] PLUGINS = HELP["Official"] if "Official" in HELP.keys() else [] ADDONS = HELP["Addons"] if "Addons" in HELP.keys() else [] for x in LIST.values(): for y in x: z.append(y) await event.edit( get_string("inline_4").format( OWNER_NAME, len(PLUGINS), len(ADDONS), len(z), ), file=INLINE_PIC, link_preview=False, buttons=[ [ Button.inline("•Pɪɴɢ•", data="pkng"), Button.inline("•Uᴘᴛɪᴍᴇ•", data="upp"), ], [ Button.inline("•Stats•", data="alive"), Button.inline("•Uᴘᴅᴀᴛᴇ•", data="doupdate"), ], [Button.inline("« Bᴀᴄᴋ", data="open")], ], )
async def help_func(ult): key, count = ult.data_match.group(1).decode("utf-8").split("_") if key == "VCBot" and HELP.get("VCBot") is None: return await ult.answer(get_string("help_12"), alert=True) elif key == "Addons" and HELP.get("Addons") is None: return await ult.answer(get_string("help_13").format(HNDLR), alert=True) if "|" in count: _, count = count.split("|") count = 0 if not count else int(count) text = _strings.get(key, "").format(OWNER_NAME, len(HELP.get(key))) await ult.edit( text, file=INLINE_PIC, buttons=page_num(count, key), link_preview=False )
async def opner(event): z = [] for x in LIST.values(): z.extend(x) await event.edit( get_string("inline_4").format( OWNER_NAME, len(HELP.get("Official", [])), len(HELP.get("Addons", [])), len(z), ), buttons=_main_help_menu, link_preview=False, )
def page_num(index, key): rows = udB.get_key("HELP_ROWS") or 5 cols = udB.get_key("HELP_COLUMNS") or 2 loaded = HELP.get(key, []) emoji = udB.get_key("EMOJI_IN_HELP") or "✘" List = [ Button.inline(f"{emoji} {x} {emoji}", data=f"uplugin_{key}_{x}|{index}") for x in sorted(loaded) ] all_ = split_list(List, cols) fl_ = split_list(all_, rows) try: new_ = fl_[index] except IndexError: new_ = fl_[0] if fl_ else [] index = 0 if index == 0 and len(fl_) == 1: new_.append([Button.inline("« Bᴀᴄᴋ »", data="open")]) else: new_.append([ Button.inline( "« Pʀᴇᴠɪᴏᴜs", data=f"uh_{key}_{index-1}", ), Button.inline("« Bᴀᴄᴋ »", data="open"), Button.inline( "Nᴇxᴛ »", data=f"uh_{key}_{index+1}", ), ]) return new_
async def opner(event): z = [] PLUGINS = HELP["Official"] if "Official" in HELP.keys() else [] ADDONS = HELP["Addons"] if "Addons" in HELP.keys() else [] for x in LIST.values(): for y in x: z.append(y) await event.edit( get_string("inline_4").format( OWNER_NAME, len(PLUGINS), len(ADDONS), len(z), ), buttons=_main_help_menu, link_preview=False, )
async def addon(event): if HELP.get("Addons"): halp = zhelps.format(OWNER_NAME, len(HELP["Addons"])) buttons = page_num(0, HELP["Addons"].keys(), "addon", "add") await event.edit(halp, buttons=buttons, link_preview=False) else: await event.answer( f"• Tʏᴘᴇ {HNDLR}setredis ADDONS True\n Tᴏ ɢᴇᴛ ᴀᴅᴅᴏɴs ᴘʟᴜɢɪɴs", cache_time=0, alert=True, )
async def inline_handler(event): z = [] for x in LIST.values(): z.extend(x) text = get_string("inline_4").format( OWNER_NAME, len(HELP.get("Official", [])), len(HELP.get("Addons", [])), len(z), ) if INLINE_PIC: result = await event.builder.photo( file=INLINE_PIC, link_preview=False, text=text, buttons=_main_help_menu, ) else: result = await event.builder.article(title="Ultroid Help Menu", text=text, buttons=_main_help_menu) await event.answer([result], private=True, cache_time=300, gallery=True)
async def uptd_plugin(event): key, file = event.data_match.group(1).decode("utf-8").split("_") index = None if "|" in file: file, index = file.split("|") key_ = HELP.get(key, []) hel_p = f"Plugin Name - `{file}`\n" help_ = "" try: for i in key_[file]: help_ += i except BaseException: if file in LIST: help_ = get_string("help_11").format(file) for d in LIST[file]: help_ += HNDLR + d help_ += "\n" if not help_: help_ = f"{file} has no Detailed Help!" help_ += "\n© Join @TeamUltroid" buttons = [] if INLINE_PIC: data = f"sndplug_{key}_{file}" if index is not None: data += f"|{index}" buttons.append( [ Button.inline( "« Sᴇɴᴅ Pʟᴜɢɪɴ »", data=data, ) ] ) data = f"uh_{key}_" if index is not None: data += f"|{index}" buttons.append( [ Button.inline("« Bᴀᴄᴋ", data=data), ] ) try: await event.edit(help_, buttons=buttons) except Exception as er: LOGS.exception(er) help = f"Do `{HNDLR}help {key}` to get list of commands." await event.edit(help, buttons=buttons)
from . import HNDLR, INLINE_PIC, LOGS, OWNER_NAME, asst, get_string, start_time, udB from ._help import _main_help_menu # ================================================# TLINK = INLINE_PIC or "https://telegra.ph/file/74d6259983e0642923fdb.jpg" helps = get_string("inline_1") add_ons = udB.get_key("ADDONS") if add_ons is not False: zhelps = get_string("inline_2") else: zhelps = get_string("inline_3") PLUGINS = HELP.get("Official", []) ADDONS = HELP.get("Addons", []) upage = 0 # ============================================# # --------------------BUTTONS--------------------# SUP_BUTTONS = [ [ Button.url("• Repo •", url="https://github.com/TeamUltroid/Ultroid"), Button.url("• Support •", url="t.me/UltroidSupport"), ], ] # --------------------BUTTONS--------------------#
async def _help(ult): plug = ult.pattern_match.group(1).strip() chat = await ult.get_chat() if plug: try: if plug in HELP["Official"]: output = f"**Plugin** - `{plug}`\n" for i in HELP["Official"][plug]: output += i output += "\n© @TeamUltroid" await ult.eor(output) elif HELP.get("Addons") and plug in HELP["Addons"]: output = f"**Plugin** - `{plug}`\n" for i in HELP["Addons"][plug]: output += i output += "\n© @TeamUltroid" await ult.eor(output) elif HELP.get("VCBot") and plug in HELP["VCBot"]: output = f"**Plugin** - `{plug}`\n" for i in HELP["VCBot"][plug]: output += i output += "\n© @TeamUltroid" await ult.eor(output) else: try: x = get_string("help_11").format(plug) for d in LIST[plug]: x += HNDLR + d x += "\n" x += "\n© @TeamUltroid" await ult.eor(x) except BaseException: file = None compare_strings = [] for file_name in LIST: compare_strings.append(file_name) value = LIST[file_name] for j in value: j = cmd_regex_replace(j) compare_strings.append(j) if j.strip() == plug: file = file_name break if not file: # the enter command/plugin name is not found text = f"`{plug}` is not a valid plugin!" if extractOne: best_match = extractOne(plug, compare_strings) text += "\nDid you mean `{}`?".format(best_match[0]) return await ult.eor(text) output = f"**Command** `{plug}` **found in plugin** - `{file}`\n" if file in HELP["Official"]: for i in HELP["Official"][file]: output += i elif HELP.get("Addons") and file in HELP["Addons"]: for i in HELP["Addons"][file]: output += i elif HELP.get("VCBot") and file in HELP["VCBot"]: for i in HELP["VCBot"][file]: output += i output += "\n© @TeamUltroid" await ult.eor(output) except BaseException as er: LOGS.exception(er) await ult.eor("Error 🤔 occured.") else: try: results = await ult.client.inline_query(asst.me.username, "ultd") except BotMethodInvalidError: z = [] for x in LIST.values(): z.extend(x) cmd = len(z) + 10 if udB.get_key("MANAGER") and udB.get_key("DUAL_HNDLR") == "/": _main_help_menu[2:3] = [[Button.inline("• Manager Help •", "mngbtn")]] return await ult.reply( get_string("inline_4").format( OWNER_NAME, len(HELP["Official"]), len(HELP["Addons"] if "Addons" in HELP else []), cmd, ), file=INLINE_PIC, buttons=_main_help_menu, ) except BotResponseTimeoutError: return await ult.eor( get_string("help_2").format(HNDLR), ) except BotInlineDisabledError: return await ult.eor(get_string("help_3")) await results[0].click(chat.id, reply_to=ult.reply_to_msg_id, hide_via=True) await ult.delete()