From 9b14e27ef4a62d356b8e33b1792f750056ba0935 Mon Sep 17 00:00:00 2001 From: Udit Karode Date: Sat, 8 Apr 2023 10:49:00 +0530 Subject: [PATCH] feat: add help command --- src/index.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/index.ts b/src/index.ts index 2b16ff5..cd0e1c2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ +import { bold, code, fmt, underline } from "telegraf/format"; import { ALLOWED_CHAT_IDS } from "../variables.js"; import { ai, getVariant, newChat, setVariant, variants } from "./ai.js"; import { checkOrigin } from "./check-origin.js"; @@ -54,6 +55,31 @@ async function main() { await ctx.reply(`The variant for this chat has been set to '${variant}'`); }); + bot.command("help", async ctx => { + await ctx.reply( + fmt`• ${underline(bold`Prompting the bot`)} +To prompt the AI, you can either use the ${code`/ai`} command with a prompt, such as: +${code`/ai what is the radius of the earth`} + +...or reply to a message from the bot. In both cases, the same conversation will be carried forward (i.e. the bot will retain context of previous messages). + +• ${underline(bold`Starting a new conversation`)} +You can use /newchat to start a new conversation. By doing this, the bot will effectively 'lose memories' of the conversations since the last /newchat. + +The bot will prompt you to do this if a conversation cannot be continued any further. + +• ${underline(bold`Setting or getting the variant`)} +You can get the bot variant using the /variant command. + +Use ${code`/variant `} to set the bot variant. Valid variants are: +‣ ${bold("Balanced")} (default): informative and friendly +‣ ${bold("Creative")}: original and imaginative +‣ ${bold("Precise")}: concise and straightforward + +The variant command accepts the name of any of these 3 variants in a case-insensitive format.`, + ); + }); + bot.launch(); console.log("Bot running!"); console.log("Use ^C to stop");