ref: replace "ctx.from.language_code" with a function to get the language code and fix ts implementation for "reply_to_message_id" (#51)
Co-authored-by: Lucas Gabriel <lucmsilva651@gmail.com>
This commit is contained in:
parent
6dce40d333
commit
87c987c16d
17 changed files with 193 additions and 160 deletions
|
@ -1,18 +1,22 @@
|
|||
import { getStrings } from '../plugins/checklang';
|
||||
import { isOnSpamWatch } from '../spamwatch/spamwatch';
|
||||
import spamwatchMiddlewareModule from '../spamwatch/Middleware';
|
||||
import { Context, Telegraf } from 'telegraf';
|
||||
import { replyToMessageId } from '../utils/reply-to-message-id';
|
||||
import { languageCode } from '../utils/language-code';
|
||||
|
||||
const spamwatchMiddleware = spamwatchMiddlewareModule(isOnSpamWatch);
|
||||
|
||||
export default (bot: any) => {
|
||||
bot.start(spamwatchMiddleware, async (ctx: any) => {
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
export default (bot: Telegraf<Context>) => {
|
||||
bot.start(spamwatchMiddleware, async (ctx: Context) => {
|
||||
const Strings = getStrings(languageCode(ctx));
|
||||
const botInfo = await ctx.telegram.getMe();
|
||||
const reply_to_message_id = replyToMessageId(ctx)
|
||||
const startMsg = Strings.botWelcome.replace(/{botName}/g, botInfo.first_name);
|
||||
|
||||
ctx.reply(startMsg, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
...({ reply_to_message_id })
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue