1
0
Fork 0
mirror of https://github.com/muerwre/vk-tg-bot.git synced 2025-04-25 15:06:41 +07:00

added help command

This commit is contained in:
Fedor Katurov 2023-12-30 18:09:02 +07:00
parent 6d3f511807
commit 621b03fb70
12 changed files with 91 additions and 9 deletions

View file

@ -16,6 +16,8 @@ export class TelegramApi {
this.telegram.bot.command("config", this.dumpConfig);
this.telegram.bot.command("pop", this.pop);
this.telegram.bot.command("wtf", this.wtf);
this.telegram.bot.command("help", this.help);
this.telegram.bot.command("start", this.help);
return;
}
@ -104,6 +106,22 @@ export class TelegramApi {
return next();
};
/**
* Sends recent logs
*/
private help = async (ctx, next) => {
const username = ctx?.update?.message?.from?.username;
const isOwner = !!username && this.telegram.isOwner(`@${username}`);
const message = this.telegram.getHelpMessage(isOwner);
if (!message) {
console.warn("No templates for help found, skipping");
}
await ctx.reply(message);
return next();
};
/**
* Probes webhook url and falls back to polling mode on error
*/