dart_telegram_bot 0.5.0-beta.1 copy "dart_telegram_bot: ^0.5.0-beta.1" to clipboard
dart_telegram_bot: ^0.5.0-beta.1 copied to clipboard

outdated

A basic Telegram Bot API wrapper made to make fast Telegram bots with as less code as possible.

example/main.dart

import 'dart:io';

import 'package:dart_telegram_bot/dart_telegram_bot.dart';
import 'package:dart_telegram_bot/telegram_entities.dart';

Future onUpdate(Bot bot, Update update) async {
  if (update.message?.text == 'stop') {
    await bot.sendMessage(ChatID(update.message!.chat.id), 'Stopping...');
    bot.stop();
  }
}

void main() async {
  var token = Platform.environment['BOT_TOKEN']!;
  var bot = await Bot.fromToken(token);

  bot.onUpdate(onUpdate);

  await bot.start(
    clean: true,
    allowedUpdates: [UpdateType.MESSAGE],
  );
}
48
likes
0
points
153
downloads

Publisher

unverified uploader

Weekly Downloads

A basic Telegram Bot API wrapper made to make fast Telegram bots with as less code as possible.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http, logging

More

Packages that depend on dart_telegram_bot