fix: back on help #43
1 changed files with 26 additions and 15 deletions
|
@ -8,6 +8,10 @@ async function sendHelpMessage(ctx, isEditing) {
|
|||
const helpText = Strings.botHelp
|
||||
.replace(/{botName}/g, botInfo.first_name)
|
||||
.replace(/{sourceLink}/g, process.env.botSource);
|
||||
function getMessageId(ctx) {
|
||||
return ctx.message?.message_id || ctx.callbackQuery?.message?.message_id;
|
||||
};
|
||||
const createOptions = (ctx, includeReplyTo = false) => {
|
||||
const options = {
|
||||
parse_mode: 'Markdown',
|
||||
disable_web_page_preview: true,
|
||||
|
@ -20,11 +24,19 @@ async function sendHelpMessage(ctx, isEditing) {
|
|||
]
|
||||
}
|
||||
};
|
||||
if (includeReplyTo) {
|
||||
const messageId = getMessageId(ctx);
|
||||
if (messageId) {
|
||||
options.reply_to_message_id = messageId;
|
||||
};
|
||||
};
|
||||
return options;
|
||||
};
|
||||
if (isEditing) {
|
||||
await ctx.editMessageText(helpText, options);
|
||||
await ctx.editMessageText(helpText, createOptions(ctx));
|
||||
} else {
|
||||
await ctx.reply(helpText, options);
|
||||
}
|
||||
await ctx.reply(helpText, createOptions(ctx, true));
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = (bot) => {
|
||||
|
@ -35,7 +47,6 @@ module.exports = (bot) => {
|
|||
bot.command("about", spamwatchMiddleware, async (ctx) => {
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
const aboutMsg = Strings.botAbout.replace(/{sourceLink}/g, `${process.env.botSource}`);
|
||||
|
||||
ctx.reply(aboutMsg, {
|
||||
parse_mode: 'Markdown',
|
||||
disable_web_page_preview: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue