checkIsLogin method

Future<bool> checkIsLogin({
  1. Client? httpClient,
})

run executable telegram bot api

Implementation

Future<bool> checkIsLogin({
  http.Client? httpClient,
}) async {
  httpClient ??= http_client;
  Map<String, String> headers = {
    "Content-length": "0",
    "Content-Type": "application/x-www-form-urlencoded",
    "origin": "https://oauth.telegram.org",
    "User-Agent":
        "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36",
  };
  Uri uri_api = Uri.parse("https://oauth.telegram.org").replace(
    pathSegments: [
      "auth",
      "login",
    ],
    queryParameters: {
      "bot_id": botId,
      "origin": botDomain,
      "request_access": "write",
      "embed": "1",
    },
  );
  String ans = await session.post(
      url: uri_api.toString(),
      headers: headers,
      body: "",
      httpClient: httpClient);

  return ans == 'true';
}