Search by

afaztech / reactor-force-join

afaztech

Force-join (mandatory channel subscription) middleware for Reactor bots.

Package info

github.com/AfazTech/reactor-force-join

Type:reactor-package

pkg:composer/afaztech/reactor-force-join

Statistics

Installs: 14

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.3.0 2026-10-23 16:11 UTC

This package is auto-updated.

Last update: 2026-10-23 17:56:09 UTC


README

PHP Version License Reactor

Required channel management for Reactor Telegram bots.

Features

  • Register required channels by username, URL, or numeric chat id
  • Automatic admin verification before a channel is added
  • Local membership cache kept in sync via chat_member updates
  • Fast membership checks that skip the Telegram API on cache hits
  • Auto-disable a channel when it reaches a target member count
  • Auto-disable a channel after a maximum number of joins driven by the bot
  • Per-channel configuration via dedicated setters
  • Enable or disable channels independently
  • Configurable per-channel member and join limits

Requirements

  • afaztech/reactor-framework ^0.5.0

Installation

composer require afaztech/reactor-force-join
./reactor migrate

Usage

use AfazTech\ReactorJoin\Contracts\JoinManagerInterface;

$join = $container->get(JoinManagerInterface::class);

// Register a channel and configure its limits.
$channel = $join->addChannel('@my_channel', [
    'target_members' => 5000, // auto-disable at 5k members (0 = no limit)
    'max_adds'       => 1000, // auto-disable after 1k bot joins (0 = disabled)
]);

// Check membership from your own middleware or handler.
$missing = $join->missingChannels($userId);
if ($missing !== []) {
    // prompt the user to join
}

// Adjust limits later.
$join->setChannelTargetMembers($channel->id, 10000);
$join->setChannelMaxAdds($channel->id, 0);
$join->resetChannelCurrentAdds($channel->id);

Documentation

For detailed documentation, see DOCUMENT.md.

Contributing

Contributions are welcome. Please read the contribution guidelines.

License

This project is licensed under the MIT License.