# ©️ 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
# ©️ Codrago, 2024-2025
# This file is a part of Heroku Userbot
# 🌐 https://github.com/coddrago/Heroku
# 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 herokutl.extensions.html import CUSTOM_EMOJIS
from herokutl.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",
"{}
{}".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 += (
f'\n{self.config["command_emoji"]}'
" {}{}
{} {}".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,
f'
{reply}{}".format(self.config["empty_emoji"], name) ] continue core = mod.__origin__.startswith("
{}
{}
{}").format( reply, "".join(core_), "".join(plain_ + (no_commands_ if force else [])), ( "" if self.lookup("Loader").fully_loaded else f"\n\n{self.strings('partial_load')}" ), ), file = self.config["banner_url"], ) @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("offchats"), )