From af5b4f261972e685c341cf92e78d4b6f400e03af Mon Sep 17 00:00:00 2001 From: Eluda <111eluda111@gmail.com> Date: Sat, 5 Nov 2022 15:57:05 +0100 Subject: [PATCH 1/2] Add the `/about` command. --- src/bot.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/bot.ts b/src/bot.ts index c3a96352..380911e9 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -1,4 +1,4 @@ -import { Bot, webhookCallback } from "grammy"; +import { Bot, InlineKeyboard, webhookCallback } from "grammy"; import express from "express"; // Create a bot using the Telegram token @@ -8,6 +8,20 @@ const bot = new Bot(process.env.TELEGRAM_TOKEN || ""); bot.command("start", (ctx) => ctx.reply("Welcome! Up and running.")); bot.command("yo", (ctx) => ctx.reply(`Yo ${ctx.from?.username}`)); +// Handle the /about command +const aboutUrlKeyboard = new InlineKeyboard().url( + "Host your own bot", + "https://cyclic.sh/" +); +bot.command("about", (ctx) => + ctx.reply( + `Hello! I'm a Telegram bot.\nI'm powered by Cyclic, the next-generation serverless computing platform.`, + { + reply_markup: aboutUrlKeyboard, + } + ) +); + // Handle all other messages bot.on("message", (ctx) => ctx.reply("Got another message!")); From 1e0362eb6a15a32800a5eea3f4634ad9253b3b08 Mon Sep 17 00:00:00 2001 From: Eluda <111eluda111@gmail.com> Date: Sat, 5 Nov 2022 17:31:07 +0100 Subject: [PATCH 2/2] Change wording in the link in the `/about` command. --- src/bot.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bot.ts b/src/bot.ts index 380911e9..32fd29c9 100644 --- a/src/bot.ts +++ b/src/bot.ts @@ -10,7 +10,7 @@ bot.command("yo", (ctx) => ctx.reply(`Yo ${ctx.from?.username}`)); // Handle the /about command const aboutUrlKeyboard = new InlineKeyboard().url( - "Host your own bot", + "Host your own bot for free.", "https://cyclic.sh/" ); bot.command("about", (ctx) =>