PHP code example of afaztech / reactor-force-join
1. Go to this page and download the library: Download afaztech/reactor-force-join library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
afaztech / reactor-force-join example snippets
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);