wizardloop/broadcastmanager

High-performance Telegram broadcast manager for MadelineProto

Fund package maintenance!
WizardLoop
wizardloop.t.me

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/wizardloop/broadcastmanager

2.0.5 2026-01-08 08:12 UTC

This package is auto-updated.

Last update: 2026-01-08 09:11:36 UTC


README

High-Performance Telegram Broadcast Manager for MadelineProto. Manage broadcasts efficiently: send messages, media albums, pin/unpin messages, control broadcasts in real-time, and track live progress with advanced features.

AGPL License Made with โค๏ธ Packagist Version Packagist Downloads

๐ŸŒŸ Features

  • ๐Ÿš€ High-Performance Broadcasts Send messages concurrently to thousands of users, groups, or channels with configurable concurrency.

  • โธ Pause / Resume / Cancel Broadcasts Control ongoing broadcasts in real-time without restarting.

  • ๐Ÿ“Œ Pin & Unpin Messages

    • Pin the last broadcasted message automatically.
    • Unpin all messages for all subscribers.
  • ๐Ÿงน Delete Last Broadcast

    • Remove previously sent messages from all users.
    • Retries failed deletions and handles Telegram API limits automatically.
  • โ™ป๏ธ Delete All Broadcasts

    • Remove previously all sent messages from all users.
    • Retries failed deletions and handles Telegram API limits automatically.
  • ๐Ÿ“Š Live Progress Tracking

    • Visual progress bars
    • Messages per second (TPS)
    • Sent, failed, and pending counts
    • Paused/cancelled indicators
  • ๐Ÿ–ผ Media Albums Support

    • Send multiple images/documents in a single broadcast using sendMultiMedia.
    • Supports captions and message entities.
  • ๐Ÿ’พ Saving & Reusing Albums
    Save albums to a JSON file for reuse in future broadcasts.
    Use album-bot as an example to store album files locally.

  • ๐Ÿ›ก FLOOD_WAIT Handling & Retries Automatically respects Telegram rate limits and retries failed messages.

  • ๐Ÿ”˜ Inline Buttons / Reply Markup

    • Include interactive buttons for links, commands, or actions.

๐Ÿ“ Repository Structure

BroadcastManager/
โ”œโ”€โ”€ src/
โ”‚   โ””โ”€โ”€ BroadcastManager.php
โ”œโ”€โ”€ data/
โ”‚   โ””โ”€โ”€ .gitkeep
โ”œโ”€โ”€ composer.json
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ CHANGELOG.md

๐Ÿ’ป Requirements

โšก Installation

composer require wizardloop/broadcastmanager

Include autoload:

require 'vendor/autoload.php';

๐Ÿš€ Usage Example

use BroadcastTool\BroadcastManager;

$manager = new BroadcastManager($api);

$manager->broadcastWithProgress(
    allUsers: $users,
    messages: $messages,
    chatId: $adminChatId,
    filterType: 'users',
    pin: true,
    concurrency: 25
);

โธ Control Broadcasts

$manager->pause();
$manager->resume();
$manager->cancel();

Check state:

if ($manager->isPaused()) echo "Paused";
if ($manager->isCancelled()) echo "Cancelled";
print_r($manager->progress());

๐Ÿงน Delete Last Broadcast

$manager->deleteLastBroadcastForAll(
    allUsers: $users,
    chatId: $adminChatId,
    concurrency: 20
);

โ™ป๏ธ Delete All Broadcast

$manager->deleteAllBroadcastsForAll(
    allUsers: $users,
    chatId: $adminChatId,
    concurrency: 20
);

๐Ÿ“Š Get Last Broadcast Data

$manager->lastBroadcastData();

๐Ÿ“Œ Pin / Unpin Messages

Pin last broadcast automatically:

$manager->broadcastWithProgress(..., pin: true);

Unpin all messages:

$manager->unpinAllMessagesForAll(...);

๐Ÿ”˜ Inline Buttons & Reply Markup

$message = [
    'message' => "Click a button below:",
    'buttons' => [
        [['text' => "Visit Website", 'url' => "https://example.com"]],
        [['text' => "Start", 'callback_data' => "start_action"]]
    ]
];

โš™๏ธ Advanced Options

  • Concurrency โ€“ Number of parallel workers.
  • Filter Types โ€“ 'users', 'groups', 'channels', 'all'
  • Album Handling โ€“ JSON-based albums with multiple media files.
  • Retries & Delays โ€“ Automatic retries with backoff.
  • Progress Tracking โ€“ Real-time broadcast stats with progress().

๐Ÿค Contributing

  1. Fork repo
  2. Create branch: git checkout -b feature/my-feature
  3. Commit changes: git commit -m "Add feature"
  4. Push branch: git push origin feature/my-feature
  5. Open Pull Request

๐Ÿ“„ License

GNU AGPL-3.0 โ€” see LICENSE.

๐Ÿ“ Changelog

See [CHANGELOG.md] for updates.

โœ… Pro Tips

  • Use pin: true to pin important broadcasts.
  • Include buttons for interactive messages.
  • Adjust concurrency for optimal performance.
  • Use pause/resume/cancel for safe broadcast control.