Created the SendErrorHandler. Useful to send custom error messages to the user whenever the message could not be found
This commit is contained in:
parent
aca8c36dfd
commit
d94480bb4e
@ -0,0 +1,25 @@
|
||||
package de.gnmyt.autoresponder.handler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class SendErrorHandler extends NotFoundHandler {
|
||||
|
||||
private final ArrayList<String> messages = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Constructor of the {@link SendErrorHandler}.
|
||||
*
|
||||
* It sends error message sto the author if the message could not be found
|
||||
* @param errorMessages The error messages you want to send
|
||||
*/
|
||||
public SendErrorHandler(String... errorMessages) {
|
||||
messages.addAll(Arrays.asList(errorMessages));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> handleRequest(String sender, String message) {
|
||||
return messages;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user