( client: TelegramClient, message: Api.Message, chatEntity: any )
| 191 | if (message.media) { |
| 192 | return false; |
| 193 | } |
| 194 | |
| 195 | const nowSec = Math.floor(Date.now() / 1000); |
| 196 | if (typeof (message as any).date === "number" && nowSec - (message as any).date > 172800) { |
| 197 | return false; |
| 198 | } |
| 199 | |
| 200 | const currentText = typeof message.message === "string" ? message.message : ""; |
| 201 | if (currentText === TEXT_PLACEHOLDER) { |
| 202 | return true; |
| 203 | } |
| 204 | |
| 205 | try { |
| 206 | await client.invoke( |
| 207 | new Api.messages.EditMessage({ |
| 208 | peer: chatEntity, |
| 209 | id: message.id, |
| 210 | message: TEXT_PLACEHOLDER, |
| 211 | }) |
| 212 | ); |
| 213 | return true; |
| 214 | } catch { |
| 215 | return false; |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | function isSavedMessagesPeer(chatEntity: any, myId: bigint): boolean { |
| 220 | return ( |
| 221 | (chatEntity?.className === "User" && chatEntity?.id?.toString?.() === myId.toString()) || |
| 222 | chatEntity?.className === "PeerSelf" || |
| 223 | chatEntity?.className === "InputPeerSelf" || |
| 224 | ((chatEntity?.className === "PeerUser" || chatEntity?.className === "InputPeerUser") && |
| 225 | chatEntity?.userId?.toString?.() === myId.toString()) |
| 226 | ); |
| 227 | } |
no outgoing calls
no test coverage detected