Исправил баг в ButtonClickAttachment
This commit is contained in:
parent
6ed4a8d273
commit
779ec0bbe9
@ -1,5 +1,6 @@
|
||||
package dev.struchkov.godfather.telegram.domain.attachment;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import dev.struchkov.godfather.main.domain.content.Attachment;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@ -21,29 +22,34 @@ public class ButtonClickAttachment extends Attachment {
|
||||
*/
|
||||
private String messageId;
|
||||
private String rawCallBackData;
|
||||
|
||||
private Map<String, ButtonArg> args = new HashMap<>();
|
||||
|
||||
public ButtonClickAttachment() {
|
||||
super(TelegramAttachmentType.BUTTON_CLICK.name());
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public void addClickArg(String type, String value) {
|
||||
isNotNull(type, value);
|
||||
args.put(type, ButtonArg.buttonArg(type, value));
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Optional<ButtonArg> getArgByType(String type) {
|
||||
isNotNull(type);
|
||||
return Optional.ofNullable(args.get(type));
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Collection<ButtonArg> getClickArgs() {
|
||||
return args.values();
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public ButtonArg getArgByTypeOrThrow(String type) {
|
||||
isNotNull(type);
|
||||
return Optional.of(args.get(type)).orElseThrow(notFoundException("Аргумент типа {0} не найден.", type));
|
||||
}
|
||||
|
||||
public Collection<ButtonArg> getClickArgs() {
|
||||
return args.values();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user