This repository has been archived on 2025-03-19. You can view files and clone it, but cannot push or open issues or pull requests.

70 lines
2.1 KiB
Java

package de.gnmyt.autoresponder.entities;
import de.gnmyt.autoresponder.event.chat.ChatMessageReceivedEvent;
import de.gnmyt.autoresponder.http.contexts.ResponderContext;
import de.gnmyt.autoresponder.http.controller.HttpResponseController;
import java.util.function.Consumer;
public class GroupCommand extends Command {
private final String group;
private final String message;
private final String sender;
/**
* Constructor of the {@link GroupCommand}
*
* @param controller The response controller
* @param context The responder context
* @param appPackageName The package name of the responder app
* @param messengerPackageName The package name of the messenger
* @param ruleId The id of the rule
* @param group The name of the group in which the message has been sent
* @param message The message itself
* @param sender The sender that sent the message
*/
public GroupCommand(HttpResponseController controller, ResponderContext context, String appPackageName, String messengerPackageName, int ruleId, String group, String message, String sender) {
super(controller, context, appPackageName, messengerPackageName, ruleId);
this.group = group;
this.message = message;
this.sender = sender;
}
/**
* Waits until a new message has been sent
*
* @param then The action that should be executed after the message has been sent
*/
public void awaitAnswer(Consumer<ChatMessageReceivedEvent> then) {
getResponderContext().LOCKED_CHANNELS.add(new LockedChannel(getGroup(), true, getSender(), then));
}
/**
* Gets the name of the group
*
* @return the name of the group
*/
public String getGroup() {
return group;
}
/**
* Gets the message
*
* @return the message
*/
public String getMessage() {
return message;
}
/**
* Gets the sender of the message
*
* @return the sender of the message
*/
public String getSender() {
return sender;
}
}