(client: TelegramClient, msg: Api.Message, chatIdStr?: string)
| 80 | return null; |
| 81 | } |
| 82 | |
| 83 | const peer = chatIdStr; |
| 84 | const resolved = await client.getInputEntity(peer); |
| 85 | if (resolved instanceof Api.InputPeerChannel) { |
| 86 | return `-100${resolved.channelId}`; |
| 87 | } |
| 88 | if (resolved instanceof Api.InputPeerChat) { |
| 89 | return `-${resolved.chatId}`; |
| 90 | } |
| 91 | if (resolved instanceof Api.InputPeerUser) { |
| 92 | return `${resolved.userId}`; |
| 93 | } |
| 94 | return null; |
| 95 | } catch (e) { |
| 96 | console.error(`[${PLUGIN_NAME}] Could not resolve peer:`, e); |
| 97 | return null; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | // ==================== Timer tracking for safe cleanup ==================== |
| 102 | const pendingTimers = new Set<ReturnType<typeof setTimeout>>(); |
| 103 |
no test coverage detected