mirror of https://github.com/coddrago/Heroku
Update loader.py
parent
94f58adfac
commit
bbb4f33230
|
@ -1276,3 +1276,39 @@ class LoaderMod(loader.Module):
|
|||
file,
|
||||
caption=text,
|
||||
)
|
||||
|
||||
def _format_result(
|
||||
self,
|
||||
result: dict,
|
||||
query: str,
|
||||
no_translate: bool = False,
|
||||
) -> str:
|
||||
commands = "\n".join([
|
||||
f"▫️ <code>{utils.escape_html(self.get_prefix())}{utils.escape_html(cmd)}</code>:"
|
||||
f" <b>{utils.escape_html(cmd_doc)}</b>"
|
||||
for cmd, cmd_doc in result["module"]["commands"].items()
|
||||
])
|
||||
|
||||
kwargs = {
|
||||
"name": utils.escape_html(result["module"]["name"]),
|
||||
"dev": utils.escape_html(result["module"]["dev"]),
|
||||
"commands": commands,
|
||||
"cls_doc": utils.escape_html(result["module"]["cls_doc"]),
|
||||
"mhash": result["module"]["hash"],
|
||||
"query": utils.escape_html(query),
|
||||
"prefix": utils.escape_html(self.get_prefix()),
|
||||
}
|
||||
|
||||
strings = (
|
||||
self.strings.get("result", "en")
|
||||
if self.config["translate"] and not no_translate
|
||||
else self.strings("result")
|
||||
)
|
||||
|
||||
text = strings.format(**kwargs)
|
||||
|
||||
if len(text) > 1980:
|
||||
kwargs["commands"] = "..."
|
||||
text = strings.format(**kwargs)
|
||||
|
||||
return text
|
||||
|
|
Loading…
Reference in New Issue