(message: Api.Message)
| 130 | |
| 131 | return this.exact && messageText === key; |
| 132 | } |
| 133 | |
| 134 | replaceReply(message: Api.Message): string { |
| 135 | let text = this.msg; |
| 136 | |
| 137 | if (message.fromId && "userId" in message.fromId) { |
| 138 | const userId = Number(message.fromId.userId); |
| 139 | const sender = message.sender as any; |
| 140 | const firstName = sender?.firstName || sender?.first_name || "User"; |
| 141 | text = text.replace( |
| 142 | "$mention", |
| 143 | `<a href="tg://user?id=${userId}">${htmlEscape(firstName)}</a>` |
| 144 | ); |
| 145 | text = text.replace("$code_id", String(userId)); |
| 146 | text = text.replace("$code_name", htmlEscape(firstName)); |
| 147 | } else { |
| 148 | text = text.replace("$mention", ""); |
| 149 | text = text.replace("$code_id", ""); |
| 150 | text = text.replace("$code_name", ""); |
| 151 | } |
| 152 | |
| 153 | if (this.delay_delete) { |
| 154 | text = text.replace("$delay_delete", String(this.delay_delete)); |
| 155 | } else { |
| 156 | text = text.replace("$delay_delete", ""); |
| 157 | } |
| 158 | |
| 159 | return text; |
| 160 | } |
| 161 |
no test coverage detected