Skip to content

Commit 2d26595

Browse files
committed
Fix /react command
The URLs returned by the API now end in .gif, so no need to append this
1 parent 7faac21 commit 2d26595

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/oakbot/command/ReactGiphyCommand.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@ public ChatActions onMessage(ChatCommand chatCommand, IBot bot) {
6262
* URL must end in a file extension in order for chat to display the
6363
* image.
6464
*/
65-
var imageUrlForChat = imageUrl + "&.gif";
65+
if (!imageUrl.endsWith(".gif")) {
66+
imageUrl += "&a=.gif";
67+
}
6668

6769
//@formatter:off
6870
var condensedMessage = new ChatBuilder()
@@ -71,7 +73,7 @@ public ChatActions onMessage(ChatCommand chatCommand, IBot bot) {
7173
.append(" (powered by ").link("GIPHY", "https://giphy.com").append(")");
7274

7375
return ChatActions.create(
74-
new PostMessage(imageUrlForChat).bypassFilters(true).condensedMessage(condensedMessage)
76+
new PostMessage(imageUrl).bypassFilters(true).condensedMessage(condensedMessage)
7577
);
7678
//@formatter:on
7779
} catch (Exception e) {

0 commit comments

Comments
 (0)