Skip to content

Commit

Permalink
chore: refactor telegram api
Browse files Browse the repository at this point in the history
  • Loading branch information
zdm committed Dec 27, 2024
1 parent f648984 commit 15ca972
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/api/telegram/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,19 @@ export default class TelegramClientApi {
return this.#call( "getMe" );
}

async checkAuthentication () {
const isAuthenticated = await this.#client.checkAuthorization();

if ( isAuthenticated ) {
this.#authenticated = true;
}
else if ( this.#authenticated ) {
this.#authenticated = false;

this.#events.emit( "signout" );
}
}

async sendMessage ( ...args ) {
return this.#call( "sendMessage", ...args );
}
Expand Down

0 comments on commit 15ca972

Please sign in to comment.