Created
April 6, 2025 17:31
-
-
Save sadiqsalau/5a39c970d8de07cd56f8e290922688eb to your computer and use it in GitHub Desktop.
GramJS Detect Connection State
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Raw } from "telegram/events"; | |
import { UpdateConnectionState } from "telegram/network"; | |
/** Add Connected Event Handler */ | |
client.addEventHandler( | |
(event) => { | |
console.log(event); | |
/** Do Something With State **/ | |
setConnected(event.state === UpdateConnectionState.connected); | |
}, | |
new Raw({ | |
types: [UpdateConnectionState], | |
}) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment