# ©️ Dan Gazizullin, 2021-2023
# This file is a part of Hikka Userbot
# 🌐 https://github.com/hikariatama/Hikka
# You can redistribute it and/or modify it under the terms of the GNU AGPLv3
# 🔑 https://www.gnu.org/licenses/agpl-3.0.html
import re
import difflib
import inspect
import logging
from hikkatl.extensions.html import CUSTOM_EMOJIS
from hikkatl.tl.types import Message
from .. import loader, utils
logger = logging.getLogger(__name__)
@loader.tds
class Help(loader.Module):
"""Shows help for modules and commands"""
strings = {"name": "Help"}
def __init__(self):
self.config = loader.ModuleConfig(
loader.ConfigValue(
"core_emoji",
"
" ) if module.__doc__: reply += ( "\n🪐 ", _name, "
" ) commands = { name: func for name, func in module.commands.items() if await self.allmodules.check_security(message, func) } if hasattr(module, "inline_handlers"): for name, fun in module.inline_handlers.items(): reply += ( "\nℹ️ " + utils.escape_html(inspect.getdoc(module)) + "\n
{}
{}".format(
f"@{self.inline.bot_username} {name}",
(
utils.escape_html(inspect.getdoc(fun))
if fun.__doc__
else self.strings("undoc")
),
)
)
for name, fun in commands.items():
reply += (
"\n".format( utils.escape_html(self.get_prefix()), name, ( " ({})".format( ", ".join( "▫️ " "{}{}
{} {}
{}{}
".format(
utils.escape_html(self.get_prefix()),
alias,
)
for alias in self.find_aliases(name)
)
)
if self.find_aliases(name)
else ""
),
(
utils.escape_html(inspect.getdoc(fun))
if fun.__doc__
else self.strings("undoc")
),
)
)
await utils.answer(
message,
reply
+ (f"\n\n{self.strings('not_exact')}" if not exact else "")
+ (
f"\n\n{self.strings('core_notice')}"
if module.__origin__.startswith("{}
{}").format( reply, "".join(core_ + plain_ + (no_commands_ if force else [])), ( "" if self.lookup("Loader").fully_loaded else f"\n\n{self.strings('partial_load')}" ), ), ) @loader.command(ru_doc="| Ссылка на чат помощи", ua_doc="| посилання для чату служби підтримки", de_doc="| Link zum Support-Chat") async def support(self, message): """| link for support chat""" await utils.answer( message, self.strings("support").format( ( utils.get_platform_emoji() if self._client.hikka_me.premium and CUSTOM_EMOJIS else "🪐" ) ), )