Search packages, repositories and app categories

Package detailsv0.6.1

teledart

A Dart library interfacing with the latest Telegram Bot API.

AndroidiOSmacOSWindowsLinux
30-day downloads
1.6K
Likes
312
Pub points
140

Install package

flutter pub add teledart

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Teledart is a Dart library that provides a clean and efficient interface to the latest Telegram Bot API. It enables developers to build Telegram bots for multiple platforms, including Android, iOS, macOS, Windows, and Linux. With support for both polling and webhook-based bot operation, Teledart simplifies message handling, user interactions, and bot management. The library is actively maintained and designed with modern Dart practices, making it suitable for real-time chat applications and automated services.

Use cases

  • Building Telegram bots for customer support
  • Creating automated messaging systems
  • Developing interactive chatbots for social media
  • Integrating Telegram notifications into apps
  • Enabling real-time user interaction

Key features

  • Supports Telegram Bot API v6+
  • Cross-platform compatibility
  • Polling and webhook integration
  • Type-safe event handling
  • Built-in message and update processing

Suitable for

  • Dart developers building Telegram bots
  • Full-stack developers integrating chat features
  • Teams creating automation tools

Considerations

  • Requires a Telegram bot token
  • Needs proper server setup for webhooks
  • May require additional configuration for production deployment

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

TeleDart

A clean implementation of Telegram bot API allows you to create your own easily.

TeleDart

Bot API Version Dart Version License: GPL v3

Readme Card

Creating a Telegram bot

In order to create a Telegram bot, you need to talk to @BotFather generating a bot token. Simply follow the instructions.

Usage

Initialising the bot:

import 'package:teledart/teledart.dart';
import 'package:teledart/telegram.dart';

void main() {
  var BOT_TOKEN = 'YOUR_BOT_TOKEN_FROM_BOT_FATHER';
  final username = (await Telegram(BOT_TOKEN).getMe()).username;
  var teledart = TeleDart(BOT_TOKEN, Event(username!));

  teledart.start()
}

A simple usage example:

teledart.onMessage(keyword: 'Fight for freedom')
    .listen((message) => message.reply('Stand with Hong Kong'));

Using bot commands:

// Long way
teledart.onMessage(entityType: 'bot_command', keyword: 'start')
    .listen((message) => teledart.sendMessage(message.chat.id, 'Hello TeleDart!'));

// Short way (recommended)
teledart.onCommand('glory')
    .listen((message) => message.reply('to Ukraine!'));

Modifying Stream:

teledart
    .onMessage(keyword: 'dart')
    .where((message) => message.text?.contains('telegram') ?? false)
    .listen((message) => message.replyPhoto(
        //  io.File('example/dash_paper_plane.png'),
        'https://raw.githubusercontent.com/DinoLeung/TeleDart/master/example/dash_paper_plane.png',
        caption: 'This is how the Dart Bird and Telegram are met'));

Inline mode example:

teledart.onInlineQuery().listen((inlineQuery) => inlineQuery.answer([
      InlineQueryResultArticle(
          id: 'ping',
          title: 'ping',
          inputMessageContent: InputTextMessageContent(
              messageText: '*pong*', parseMode: 'MarkdownV2')),
      InlineQueryResultArticle(
          id: 'ding',
          title: 'ding',
          inputMessageContent: InputTextMessageContent(
              messageText: '*_dong_*', parseMode: 'MarkdownV2')),
    ]));

Bugs and feature requests

Please file feature requests and bugs at the issue tracker.

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package

No data available yet.