Added the ResponderContext to the ChatCommand & the GroupCommand
This commit is contained in:
parent
4938db2024
commit
0c28fe65d8
@ -1,10 +1,8 @@
|
|||||||
package de.gnmyt.autoresponder.entities;
|
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 de.gnmyt.autoresponder.http.controller.HttpResponseController;
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class ChatCommand extends Command {
|
public class ChatCommand extends Command {
|
||||||
|
|
||||||
private final String sender;
|
private final String sender;
|
||||||
@ -13,22 +11,20 @@ public class ChatCommand extends Command {
|
|||||||
/**
|
/**
|
||||||
* Constructor of the {@link ChatCommand}
|
* Constructor of the {@link ChatCommand}
|
||||||
*
|
*
|
||||||
|
* @param controller The response controller
|
||||||
|
* @param context The responder context
|
||||||
* @param appPackageName The package name of the responder app
|
* @param appPackageName The package name of the responder app
|
||||||
* @param messengerPackageName The package name of the messenger
|
* @param messengerPackageName The package name of the messenger
|
||||||
* @param ruleId The id of the rule
|
* @param ruleId The id of the rule
|
||||||
* @param sender The sender of the message
|
* @param sender The sender of the message
|
||||||
* @param message The message itself
|
* @param message The message itself
|
||||||
*/
|
*/
|
||||||
public ChatCommand(HttpResponseController controller, String appPackageName, String messengerPackageName, int ruleId, String sender, String message) {
|
public ChatCommand(HttpResponseController controller, ResponderContext context, String appPackageName, String messengerPackageName, int ruleId, String sender, String message) {
|
||||||
super(controller, appPackageName, messengerPackageName, ruleId);
|
super(controller, context, appPackageName, messengerPackageName, ruleId);
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void awaitAnswer(Consumer<ChatMessageReceivedEvent> then) {
|
|
||||||
then.accept(new ChatMessageReceivedEvent(null, null, null, 1, null, null, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sender
|
* Gets the sender
|
||||||
*
|
*
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package de.gnmyt.autoresponder.entities;
|
package de.gnmyt.autoresponder.entities;
|
||||||
|
|
||||||
|
import de.gnmyt.autoresponder.http.contexts.ResponderContext;
|
||||||
import de.gnmyt.autoresponder.http.controller.HttpResponseController;
|
import de.gnmyt.autoresponder.http.controller.HttpResponseController;
|
||||||
|
|
||||||
public class GroupCommand extends Command {
|
public class GroupCommand extends Command {
|
||||||
@ -11,6 +12,8 @@ public class GroupCommand extends Command {
|
|||||||
/**
|
/**
|
||||||
* Constructor of the {@link GroupCommand}
|
* 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 appPackageName The package name of the responder app
|
||||||
* @param messengerPackageName The package name of the messenger
|
* @param messengerPackageName The package name of the messenger
|
||||||
* @param ruleId The id of the rule
|
* @param ruleId The id of the rule
|
||||||
@ -18,8 +21,8 @@ public class GroupCommand extends Command {
|
|||||||
* @param message The message itself
|
* @param message The message itself
|
||||||
* @param sender The sender that sent the message
|
* @param sender The sender that sent the message
|
||||||
*/
|
*/
|
||||||
public GroupCommand(HttpResponseController controller, String appPackageName, String messengerPackageName, int ruleId, String group, String message, String sender) {
|
public GroupCommand(HttpResponseController controller, ResponderContext context, String appPackageName, String messengerPackageName, int ruleId, String group, String message, String sender) {
|
||||||
super(controller, appPackageName, messengerPackageName, ruleId);
|
super(controller, context, appPackageName, messengerPackageName, ruleId);
|
||||||
this.group = group;
|
this.group = group;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
|
Reference in New Issue
Block a user