Erebot latest-0.6.0-74-g691fc3f documentation

PhpFilter module

«  MiniSed module   ::   Contents   ::   PingReply module  »

PhpFilter module

Description

This module transforms its input using a PHP stream filter.

Configuration

Options

This module provides several configuration options.

Options for \Erebot\Module\PhpFilter
Name Type Default value Description
trigger string “filter” The command to use to ask the bot to transform a text using a filter.
whitelist string “string.*,convert.*“ A whitelist of allowed filters, separated by commas. Wildcards supported.

Warning

The trigger should only contain alphanumeric characters (in particular, do not add any prefix, like ”!” to that value).

Example

In this example, we configure the bot to allow only a few string filters to be used (toupper which turns all letters into uppercase, tolower which turns them into lowercase letters and rot13 which applies a 13 letters rotation to text, much like Caesar’s cipher).

<?xml version="1.0"?>
<configuration
  xmlns="http://localhost/Erebot/"
  version="0.20"
  language="fr-FR"
  timezone="Europe/Paris">

  <modules>
    <!-- Other modules ignored for clarity. -->

    <module name="\Erebot\Module\PhpFilter">
      <param name="whitelist" value="string.toupper,string.tolower,string.rot13" />
    </module>
  </modules>
</configuration>

Usage

This section assumes default values are used for all triggers. Please refer to configuration options for more information on how to customize triggers.

Provided commands

This module provides the following commands:

Commands provided by \Erebot\Module\PhpFilter
Command Description
!filter Displays available filters and a quick usage note.
!filter filter input Displays the result of using the given filter on the given input.

Example

20:37:25 <+Foobar> !filter string.rot13 V ybir CUC!
20:37:27 < Erebot> string.rot13: I love PHP!

«  MiniSed module   ::   Contents   ::   PingReply module  »