Skip to content

Commit 934aacb

Browse files
committed
Added @SquidXTV changes
1 parent 7871f6b commit 934aacb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

application/src/main/java/org/togetherjava/tjbot/features/github/GitHubReference.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ public final class GitHubReference extends MessageReceiverAdapter {
4545
Pattern.compile("#(?<%s>\\d{1,5})".formatted(ID_GROUP));
4646

4747
// Representing different GitHub states of an Issue/PR
48-
private static final int OPEN_STATE = Color.green.getRGB();
49-
private static final int CLOSE_STATE = Color.red.getRGB();
50-
private static final int MERGED_STATE = new Color(141, 106, 187).getRGB();
51-
private static final int NOT_PLANNED_STATE = new Color(72, 72, 72).getRGB();
52-
private static final int DRAFT_STATE = Color.gray.getRGB();
48+
private static final Color OPEN_STATE = Color.green;
49+
private static final Color CLOSE_STATE = Color.red;
50+
private static final Color MERGED_STATE = new Color(141, 106, 187);
51+
private static final Color NOT_PLANNED_STATE = new Color(72, 72, 72);
52+
private static final Color DRAFT_STATE = Color.gray;
5353

5454

5555
/**
@@ -173,7 +173,7 @@ MessageEmbed generateReply(GHIssue issue) throws UncheckedIOException {
173173
String dateOfCreation = FORMATTER.format(createdAt);
174174

175175
String footer = "%s • %s • %s".formatted(labels, assignees, dateOfCreation);
176-
return new EmbedBuilder().setColor(getIssueState(issue))
176+
return new EmbedBuilder().setColor(getIssueStateColor(issue))
177177
.setTitle(title, titleUrl)
178178
.setDescription(description)
179179
.setAuthor(issue.getUser().getName(), null, issue.getUser().getAvatarUrl())
@@ -188,11 +188,11 @@ MessageEmbed generateReply(GHIssue issue) throws UncheckedIOException {
188188
/**
189189
* Returns the state of the issue/PR
190190
*/
191-
private int getIssueState(GHIssue issue) throws IOException {
192-
if (issue instanceof GHPullRequest pR) {
193-
if (pR.isMerged()) {
191+
private Color getIssueStateColor(GHIssue issue) throws IOException {
192+
if (issue instanceof GHPullRequest pr) {
193+
if (pr.isMerged()) {
194194
return MERGED_STATE;
195-
} else if (pR.isDraft()) {
195+
} else if (pr.isDraft()) {
196196
return DRAFT_STATE;
197197
}
198198
} else {

0 commit comments

Comments
 (0)