paperplane 0.3.0 copy "paperplane: ^0.3.0" to clipboard
paperplane: ^0.3.0 copied to clipboard

outdated

A Flying Telegram Bot API Wrapper created from Scratch and Paper.

example/paperplane_example.dart

/**
 * PaperPlane - Just a Telegram Library for Dart
 * Copyright (c) 2020 Nebulino
 */

import 'dart:io' as io;

import 'package:paperplane/paperplane.dart';

// Just an example of Bot
void main() async {
  // var bot = PaperPlane.createBot('TOKEN');
  var bot = PaperPlane.createFromFile(
      await BotFile.import(file_name: 'PaperPlaneBot.json'));
  await bot.init();

  // Information from Telegram
  await bot.api.methods.getMe().then((response) {
    print('getMe:\n${response.toJson()}');
  });

  // Information from PaperPlane
  print('getBot:\n${bot.me.toJson().toString()}');

  // Exporting the Bot infos
  // bot.export(file_name: 'PaperPlaneBot.json');

  var methods = Methods.fromBot(bot);
  // fake chat_id
  var a_chat_id = 999999999;

  await methods.sendMessage(a_chat_id, 'Hi from PaperPlane!');
}
6
likes
0
pub points
0%
popularity

Publisher

verified publishernebulino.cloud

A Flying Telegram Bot API Wrapper created from Scratch and Paper.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http, json_annotation

More

Packages that depend on paperplane