hudson.plugins.im.bot
Class BotCommand

java.lang.Object
  extended by hudson.plugins.im.bot.BotCommand
All Implemented Interfaces:
hudson.ExtensionPoint
Direct Known Subclasses:
AbstractTextSendingCommand, Bot.HelpCommand, QueueCommand, SetAliasCommand.AliasCommand

public abstract class BotCommand
extends java.lang.Object
implements hudson.ExtensionPoint

Command pattern contract for IM bot commands.

To register custom bot commands, define a subtype and then put @Extension on your class.

Author:
Pascal Bleser, Christoph Kutzinski, Kohsuke Kawaguchi
See Also:
Bot

Nested Class Summary
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
hudson.ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Constructor Summary
BotCommand()
           
 
Method Summary
static hudson.ExtensionList<BotCommand> all()
          Returns all the registered BotCommands.
abstract  void executeCommand(Bot bot, IMChat chat, IMMessage message, Sender sender, java.lang.String[] args)
          Execute a command.
abstract  java.util.Collection<java.lang.String> getCommandNames()
          Obtains the name of the command.
abstract  java.lang.String getHelp()
          Return the command usage text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BotCommand

public BotCommand()
Method Detail

getCommandNames

public abstract java.util.Collection<java.lang.String> getCommandNames()
Obtains the name of the command. Single commands can register multiple aliases, so this method returns a collection.

Returns:
Can be empty but never null.

executeCommand

public abstract void executeCommand(Bot bot,
                                    IMChat chat,
                                    IMMessage message,
                                    Sender sender,
                                    java.lang.String[] args)
                             throws IMException
Execute a command.

Parameters:
bot - The bot for which this command runs. Never null.
chat - the IMChat object, may be used to send reply messages
message - the original IMMessage
sender - the command sender
args - arguments passed to the command, where args[0] is the command name itself
Throws:
IMException - if anything goes wrong while communicating with the remote IM server

getHelp

public abstract java.lang.String getHelp()
Return the command usage text.

Returns:
the command usage text

all

public static hudson.ExtensionList<BotCommand> all()
Returns all the registered BotCommands.



Copyright © 2010. All Rights Reserved.