(message: Api.Message)
| 510 | const aliasId = keywordAlias.get(chatId); |
| 511 | if (aliasId) { |
| 512 | const aliasTasks = this.getTasksForChat(aliasId); |
| 513 | for (const task of aliasTasks) { |
| 514 | if (task.checkNeedReply(message)) { |
| 515 | await task.processKeyword(message); |
| 516 | } |
| 517 | } |
| 518 | } |
| 519 | |
| 520 | const tasks = this.getTasksForChat(chatId); |
| 521 | for (const task of tasks) { |
| 522 | if (task.checkNeedReply(message)) { |
| 523 | await task.processKeyword(message); |
| 524 | } |
| 525 | } |
| 526 | } catch (error) { |
| 527 | console.error("Check and reply error:", error); |
| 528 | } |
| 529 | } |
| 530 | } |
| 531 | |
| 532 | function toNumber(value: any): number { |
| 533 | if (typeof value === "number") return value; |
| 534 | if (typeof value === "bigint") return Number(value); |
| 535 | if (typeof value === "string") return parseInt(value, 10) || 0; |
| 536 | return 0; |
| 537 | } |
| 538 | |
| 539 | function getChatId(msg: Api.Message): number { |
no test coverage detected