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,8 +1,12 @@
|
|||
export default function verifyInput(ctx: any, userInput: string, message: string, verifyNaN = false) {
|
||||
if (!userInput || (verifyNaN && isNaN(Number(userInput)))) { // not sure why isNaN is used here, but the input should be a number
|
||||
import { Context } from "telegraf";
|
||||
import { replyToMessageId } from "../utils/reply-to-message-id";
|
||||
|
||||
export default function verifyInput(ctx: Context, userInput: string, message: string, verifyNaN = false) {
|
||||
const reply_to_message_id = replyToMessageId(ctx);
|
||||
if (!userInput || (verifyNaN && isNaN(Number(userInput)))) {
|
||||
ctx.reply(message, {
|
||||
parse_mode: "Markdown",
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
...({ reply_to_message_id })
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue