Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Mar 12, 2020. It is now read-only.

Phergie plugin for monitoring and providing access to user mode information

License

NotificationsYou must be signed in to change notification settings

phergie/phergie-irc-plugin-react-usermode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Phergie plugin for monitoring and providing access to user mode information.

Build Status

Install

The recommended method of installation isthrough composer.

{"require": {"phergie/phergie-irc-plugin-react-usermode":"~2"    }}

See Phergie documentation for more information oninstalling and enabling plugins.

Configuration

new \Phergie\Irc\Plugin\React\UserMode\Plugin(array(// All configuration is optional'prefixes' =>array('@' =>'o','+' =>'v',    ),))

When the bot joins a channel, it receives a343 RPL_NAMREPLY server eventcontaining user nicks prefixed with characters indicative of their respectivechannel-specific user modes.

This plugin's only configuration setting allowsthis mappingof prefix to user mode characters to be overridden in cases where a networkuses non-standard mappings. The plugin's default mapping includes severalstandard prefixes, which are shown in the example above, and several commonlyused non-standard prefixes.

Usage

usePhergie\Irc\Bot\React\PluginInterface;usePhergie\Irc\Bot\React\EventQueueInterface;usePhergie\Irc\Plugin\React\Command\CommandEvent;class FooPluginimplements PluginInterface{/**     * @var \Phergie\Irc\Plugin\React\UserMode\Plugin     */protected$userMode;publicfunction__construct(array$config)    {// Validate $config['userMode']$this->userMode =$config['userMode'];    }publicfunctiongetSubscribedEvents()    {returnarray('command.foo' =>'handleFooCommand',        );    }publicfunctionhandleFooCommand(CommandEvent$event,EventQueueInterface$queue)    {$connection =$event->getConnection();$nick =$event->getNick();$params =$event->getParams();$source =$event->getCommand() ==='PRIVMSG'            ?$params['receivers']            :$params['nickname'];// Ignore events sent directly to the bot rather than to a channelif ($connection->getNickname() ===$source) {return;        }// Don't process the command if the user is not a channel operatorif (!$this->userMode->userHasMode($connection,$source,$nick,'o')) {return;        }// The user is a channel operator, continue processing the command// ...    }}

Tests

To run the unit test suite:

curl -s https://getcomposer.org/installer | phpphp composer.phar install./vendor/bin/phpunit

License

Released under the BSD License. SeeLICENSE.

About

Phergie plugin for monitoring and providing access to user mode information

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors5

Languages


[8]ページ先頭

©2009-2025 Movatter.jp