PaperPlane
Just a Telegram Library for Dart.
A package to interact with the official
Disclaimer
I'm doing it just for fun, so... use at your own risk.
I hope it will become something great.
^-^
Usage
First generate the code for Serializable (if you clone the repository):
dart run build_runner build
A simple usage example:
import 'dart:io' as io;
import 'package:paperplane/helpers.dart';
import 'package:paperplane/paperplane.dart';
void main() {
const token = 'YOUR_BOT_TOKEN';
final bot = PaperPlane.createBot(token: token);
bot.engine();
bot.startPolling();
// Work with events...
bot
.onMessage()
.where((message) => message.text == 'owo')
.listen((message) => message.replyText(text: 'uwu'));
// Work with updates and directly with API methods...
final api = bot.api;
final updater = bot.updater.onUpdate();
updater
.where((update) => update.message?.text == 'animate')
.listen((update) {
final chatId = update.message?.chat?.id;
if (chatId != null) {
api.sendAnimation(
chatID: ChatID.fromID(chatId),
animation: Luggage.withFile(file: io.File('./files/gifs/bunny_girl.gif')),
);
}
});
}
Get PaperPlane
Add PaperPlane dependency to pubspec.yaml:
From GitHub:
dependencies:
paperplane:
git:
url: https://github.com/Nebulino/PaperPlane.git
ref: telegram-api-update
From pub.dev:
dependencies:
paperplane: ^0.7.0
Features
- Dart 3 Ready: Full sound null safety and modern language features.
- Modern Telegram Bot API: Support for
ReplyParameters,LinkPreviewOptions,TextQuote,MessageId. - Batch Message Operations:
deleteMessages,forwardMessages,copyMessages,copyMessage. - Forum Topics & Threads: Message thread ID support across sending methods.
- Media Customization: Spoiler animations, captions above media, and content protection.
- Convenient Helpers:
Luggagefor file/stream uploads,Messageextensions (replyText,forward,copy,delete).
Please file feature requests and bugs at the issue tracker.
License
Released under the MIT License.
Copyright © 2020-2026 Nebulino
Libraries
- helpers
- PaperPlane Helpers Library. Import this to use some helpers.
- paperplane
- PaperPlane Library. Import this if you want to do a simple bot.
- paperplane_exceptions
- PaperPlane's exceptions Library. It helps to manage different type of exception inside my library.
- telegram
- Telegram Library. It groups all the Telegram Api objects. All objects used in the Bot API responses are represented as JSON-objects. It is safe to use 32-bit signed integers for storing all Integer fields unless otherwise noted. Optional fields may be not returned when irrelevant.