2017 © Pedro Peláez
 

library phergie-user-watch-plugin

Phergie plugin to watch and handle users.

image

hashworks/phergie-user-watch-plugin

Phergie plugin to watch and handle users.

  • Wednesday, March 28, 2018
  • by hashworks
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

PhergieUserWatch

Phergie plugin to watch joins, parts and quits of users. You can also whois users easily., (*1)

About

This plugin was originally written to keep the growing amount of monitoring-bots in the Rizon network out of channels. However you can do what you want with the callbacks, it'll require a bit of PHP knowledge though., (*2)

Install

Use the command below to install it with Composer to the current $PWD., (*3)

composer require hashworks/phergie-user-watch-plugin

See Phergie documentation for more information on installing and enabling plugins., (*4)

Configuration Examples

The configuration allows you to set up to 3 callbacks: joinCallback, partCallback and quitCallback. Below are some examples., (*5)

// 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 requires a secure connection.');
                        }
                    });
                }
        )
)
// 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.');
                            }
                        }
                    });
                }
        )
)

The Versions

28/03 2018

dev-master

9999999-dev

Phergie plugin to watch and handle users.

  Sources   Download

GNU GPL v3.0 GPL-3.0-or-later

The Requires

 

plugin bot irc watch whois phergie join part

13/06 2015

v0.1

0.1.0.0

Phergie plugin to watch and handle users.

  Sources   Download

GNU GPL v3.0

The Requires

 

plugin bot irc watch whois phergie join part

10/06 2015

v0.0.4

0.0.4.0

Phergie plugin to watch and handle users.

  Sources   Download

GNU GPL v3.0

The Requires

 

plugin bot irc watch whois phergie join part

29/04 2015

v0.0.3

0.0.3.0

Phergie plugin to watch and handle users.

  Sources   Download

GNU GPL v3.0

The Requires

 

plugin bot irc watch whois phergie join part

24/04 2015

v0.0.2

0.0.2.0

Phergie plugin to watch and handle users.

  Sources   Download

GNU GPL v3.0

The Requires

 

plugin bot irc watch whois phergie join part

24/04 2015

v0.0.1

0.0.1.0

Phergie plugin to watch and handle users.

  Sources   Download

GNU GPL v3.0

The Requires

 

plugin bot irc watch whois phergie join part