-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCommandHandler.java
40 lines (36 loc) · 1.39 KB
/
CommandHandler.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package chat.tamtam.bot.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Indicates that an annotated method handles incoming bot command (a message started with `/command`).
* Such methods are considered as candidates for auto-detection
* when its containing class added as "handler" to {@link chat.tamtam.bot.TamTamBotBase TamTamBotBase} or its inheritors.
* An annotated method must have {@link chat.tamtam.botapi.model.Message Message}
* as the first parameter in the definition, but amount of parameters can be more than one.
* <p>
* There is one more way to define command: using {@link chat.tamtam.bot.commands.Command} and
* {@link chat.tamtam.bot.commands.CommandHandler}
*
* @author alexandrchuprin
* @see chat.tamtam.bot.TamTamBotBase
* @see chat.tamtam.botapi.model.Message
* @see chat.tamtam.bot.commands.Command
* @see chat.tamtam.bot.commands.CommandHandler
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface CommandHandler {
/**
* Command name, it mustn't be empty or null.
* Can start with '/' or without.
*
* @return the suggested command name
*/
String value();
/**
* Specifies whether the command's arguments should be parsed.
*/
boolean parseArgs() default true;
}