Skip to content

Commit

Permalink
fix(interactive-message): Fix isOnce being required
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco (Valandur) committed Jul 17, 2018
1 parent bc2c431 commit 539c9ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/main/java/valandur/webapi/message/InteractiveMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public UUID getUUID() {
* The id of the message. Useful to identify it in the response.
* @return The id of the message.
*/
@ApiModelProperty(value = "The id of the message. Used for sender of the message to identify responses.", required = true)
@ApiModelProperty(value = "The id of the message. Used to identify responses.", required = true)
public String getId() {
return id;
}
Expand Down Expand Up @@ -81,8 +81,8 @@ public Text getMessage() {
*/
@ApiModelProperty("True if this message can only be replied to once per target, false otherwise")
@JsonDetails
public Boolean isOnce() {
return once;
public boolean isOnce() {
return once != null && once;
}

private List<InteractiveMessageOption> options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void sendMessage(InteractiveMessage msg) {
builder.append(msg.getMessage());
}

if (msg.isOnce() != null && msg.isOnce()) {
if (msg.isOnce()) {
replied.put(msg.getUUID(), new ConcurrentSkipListSet<>());
}

Expand All @@ -57,7 +57,7 @@ public void sendMessage(InteractiveMessage msg) {
Collection<String> replies = replied.get(msg.getUUID());
if (replies.contains(source.getIdentifier())) {
source.sendMessage(Text
.builder("You have already replied to this messsage")
.builder("You have already replied to this message")
.color(TextColors.RED)
.build()
);
Expand All @@ -66,7 +66,8 @@ public void sendMessage(InteractiveMessage msg) {
replies.add(source.getIdentifier());
}

InteractiveMessageResponse response = new InteractiveMessageResponse(msg.getId(), data, source.getIdentifier());
InteractiveMessageResponse response = new InteractiveMessageResponse(
msg.getId(), data, source.getIdentifier());
WebAPI.getWebHookService().notifyHooks(WebHookService.WebHookType.INTERACTIVE_MESSAGE, response);
})).build();

Expand Down

0 comments on commit 539c9ce

Please sign in to comment.