diff --git a/src/modules/util/help-command.js b/src/modules/util/help-command.js index 7db12ee..36b0495 100644 --- a/src/modules/util/help-command.js +++ b/src/modules/util/help-command.js @@ -17,6 +17,9 @@ import { getCurrentRegistry } from "../registry.js"; * @typedef {import("../validate-command.js").ModuleCommand} ModuleCommand */ +const REPO_URL = "https://github.com/tiennm99/miti99bot"; +const SUPPORT_FOOTER = `Enjoying the bot? Support me by starring the repo: ${REPO_URL}`; + /** * Pure render step — exported separately so tests can assert on the string * without instantiating a bot context. @@ -51,7 +54,8 @@ export function renderHelp(reg) { sections.push(`${escapeHtml(mod.name)}\n${lines.join("\n")}`); } - return sections.length > 0 ? sections.join("\n\n") : "no commands registered"; + const body = sections.length > 0 ? sections.join("\n\n") : "no commands registered"; + return `${body}\n\n${SUPPORT_FOOTER}`; } /** @type {ModuleCommand} */ @@ -62,7 +66,7 @@ export const helpCommand = { handler: async (ctx) => { const reg = getCurrentRegistry(); const text = renderHelp(reg); - await ctx.reply(text, { parse_mode: "HTML" }); + await ctx.reply(text, { parse_mode: "HTML", link_preview_options: { is_disabled: true } }); }, }; diff --git a/tests/modules/util/help-command.test.js b/tests/modules/util/help-command.test.js index 8ba6104..1cc0bd0 100644 --- a/tests/modules/util/help-command.test.js +++ b/tests/modules/util/help-command.test.js @@ -99,6 +99,13 @@ describe("renderHelp", () => { it("returns a placeholder when no commands are visible", () => { const reg = makeRegistry([{ name: "a", commands: [cmd("hidden", "private", "H")] }]); - expect(renderHelp(reg)).toBe("no commands registered"); + expect(renderHelp(reg)).toContain("no commands registered"); + }); + + it("appends a support footer with the repo link", () => { + const reg = makeRegistry([{ name: "a", commands: [cmd("one", "public", "A-one")] }]); + const out = renderHelp(reg); + expect(out).toContain("star"); + expect(out).toContain("https://github.com/tiennm99/miti99bot"); }); });