PPF Home
Plugins
Developers
   Font size:      

Trigger Message (v1.2)

PDF
PDF

Description

This plugin allows you to setup triggers for the bot to respond to.

The Trigger Message plugin lets the bot respond to triggers that you can set up and maintain. For example, you could tell the bot that whenever someone says "hello" ... it will reply with "Hi! How are you?". This could be used to anything from silly responses to useful information, such as a trigger for "www" that could point to a website related to where the bot is. Triggers are global for the bot.

Every response can contain multiple commands separated by semicolons. If a response starts with /me an action is issued, /msg results in a private message, /notice - you'll figure out that ;)

In the reponse $sender is replaced with the nick of the user who issued the triggering message, $channel with the channel name.

You can also make the bot respond to a triggering message with a reponse chosen randomly from a set of responses. So if someone says "hello" the bot replies with "Hi", but the next time someone says "hello" the bot replies with "hello $sender".

If you want to make the bot respond to not only exact matches but part of messages, you can use the -e switch and use the regular expression syntax.

For regular expression triggers, the response can use backreferences to subexpressions, using $1, $2 and so on, that will be replaced with the content of the matching subexpression.

Configuration

The configuration file for this plugin is system/TriggerMessage/TriggerMessageConfig.xml

commandAddTrigger

The command for adding a new trigger. You can set the authLevel to control who is allowed to access the command. The output is used to define where the output from the command will go.

  • authLevel - ANY, ADMIN, MASTER, TRUSTED, NONE
  • output - CHANNEL, PM, NOTICE

    <commandAddTrigger authLevel="trusted" output="notice">!at</commandAddTrigger>

    

commandRemoveTrigger

The command for removing a trigger. You can set the authLevel to control who is allowed to access the command. The output is used to define where the output from the command will go.

  • authLevel - ANY, ADMIN, MASTER, TRUSTED, NONE
  • output - CHANNEL, PM, NOTICE

    <commandRemoveTrigger authLevel="trusted" output="notice">!rt</commandRemoveTrigger>

    

commandShowTriggers

The command for showing all triggers. You can set the authLevel to control who is allowed to access the command.

  • authLevel - ANY, ADMIN, MASTER, TRUSTED, NONE

    <commandShowTriggers authLevel="trusted">!st</commandShowTriggers>

    

Commands

Add a trigger

Command: !at
Description: This adds a trigger to the list of triggers for the bot to respond to
Auth Level: trusted
Where to give command: channel
Outputs to: notice that trigger has been added
Example(s):

  • simple trigger: !at "!www" "http://www.deaded.com"
  • multiple responses: !at "showall" "hi $sender; /me can do actions; multiple lines; of different types; /msg $sender and private queries; /notice $sender and notice spam too! :P"
  • random response: !at "hi" "hi" "hi $sender" "hello" "Dr. $sender, I presume" "do I know you?"
  • regular expression trigger: !at -e "but what has .* to do with the price of fish\?" "oh it's monty"
  • regular expression trigger with backreference: !at "!slap (.*)" "/me slaps $1 around a bit"

Remove a trigger

Command: !rt
Description: This removes a trigger from the list of triggers for the bot to respond to, so the bot will no longer respond to that trigger
Auth Level: trusted
Where to give command: channel
Outputs to: notice that trigger has been removed
Example(s):

  • !rt !www
  • !rt showall

Show all triggers

Command: !st
Description: This will show the entire list of triggers and their responses
Auth Level: trusted
Where to give command: private message
Outputs to: DCC chat
Example(s):

  • !st

Change History

1.2 Added backreferences to regular expression triggers -- EdorFaus
1.1 Added multiple random responses and regular expression triggers -- jawe
v1.0 First Version by DeadEd