telegram_bot_api 0.0.1 copy "telegram_bot_api: ^0.0.1" to clipboard
telegram_bot_api: ^0.0.1 copied to clipboard

outdated

Latest Telegram Bot APi Auto updates versions.

Telegram Bot Api Dart #

Telegram Bot api dart library auto update from official Telegram-Bot-Api, Support All Method Api.

Install #

dart pub add telegram_bot_api

Instal from github #

telegram_bot_api:
  git:
    url: https://github.com/azkadev/telegram_bot_api.git
    ref: main

Quickstart #

import 'package:telegram_bot_api/telelegram_bot_api.dart';
import 'package:switchscript/switchscript.dart';
import 'dart:io';

void main() async {
  stdout.write("Paste your token bot from @botfather here: ");
  var tokenBot = stdin.readLineSync().toString();
  if (tokenBot.isNotEmpty) {
    var tg = Telegram(tokenBot);
    stdout.write("Enter your chat_id : ");
    var chatId = stdin.readLineSync();
    if (chatId.toString().isNotEmpty) {
      // ignore: non_constant_identifier_names
      var chat_id = chatId;
      // request raw auto update library latest
      var options = {"chat_id": chat_id, "text": "hello world"};
      try {
        await tg.api.request("sendMessage", options);

        await tg.api.sendMessage(chat_id, "hello world");
        var request = await tg.api.request("getMe");
        print(JSON.stringify(request["result"], null, 2));
      } catch (e) {
        try {
          await tg.api.sendMessage(chat_id, e.toString());
        } catch (e) {
          print(e);
        }
      }
    } else {
      print("silahkan ulangin lagi dari awal");
    }
  } else {
    print("silahkan ulangin lagi dari awal");
  }
}
3
likes
0
pub points
29%
popularity

Publisher

unverified uploader

Latest Telegram Bot APi Auto updates versions.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

switchscript

More

Packages that depend on telegram_bot_api