PHP code example of hashworks / phergie-user-watch-plugin
1. Go to this page and download the library: Download hashworks/phergie-user-watch-plugin 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/ */
hashworks / phergie-user-watch-plugin example snippets
// Simple example, give voice to every user who joins the channel.
new \hashworks\Phergie\Plugin\UserWatch\Plugin(array(
'joinCallback' => function(\hashworks\Phergie\Plugin\UserWatch\User $user) {
$user->setChannelMode('+v', $user->getNick());
}
)
)
// Kick everyone who isn't using a secure connection.
new \hashworks\Phergie\Plugin\UserWatch\Plugin(array(
'joinCallback' => function(\hashworks\Phergie\Plugin\UserWatch\User $user) {
$user->queueWhois(function() use($user) {
if (!$user->hasSecureConnection()) {
$user->kick('This channel
// This is kinda how I use it. Kickban every user who is in 13 channels or more. Ban based on nick and username, replace numbers with question marks.
new \hashworks\Phergie\Plugin\UserWatch\Plugin(array(
'joinCallback' => function(\hashworks\Phergie\Plugin\UserWatch\User $user) {
$user->queueWhois(function() use($user) {
if (count($user->getChannels()) >= 13) {
$banMask = preg_replace_callback('/^(?<nick>.+?)(?<nicknumbers>[0-9]{0,})!(?<username>.+?)(?<usernumbers>[0-9]{0,})@.+$/', function ($matches) {
return $matches['nick'] . str_replace(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), '?', $matches['nicknumbers']) . '!' .
$matches['username'] . str_replace(array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9), '?', $matches['usernumbers']) . '@*';
}, $user->getNick() . '!' . $user->getUsername() . '@' . $user->getHost());
if (!empty($banMask)) {
$user->setChannelMode('+b', $banMask);
$user->kick('You have been kicked automatically. Please contact hashworks to file a complaint.');
$user->privmsgUser('You have been banned automatically from ' . $user->getEvent()->getSource() . '. . Please contact hashworks to file a complaint.');
}
}
});
}
)
)
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.