Skip to content

Commit 9c9b6d4

Browse files
committed
docs: add more JavaDocs
1 parent 88ebdd7 commit 9c9b6d4

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

application/src/main/java/org/togetherjava/tjbot/features/basic/ChatGPTFormatter.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,27 @@
44

55
import java.util.Optional;
66

7+
/**
8+
* A utility class for formatting code using ChatGPT.
9+
*/
710
public final class ChatGPTFormatter {
811
private final ChatGptService chatGptService;
912

13+
/**
14+
* Constructs a new {@link ChatGPTFormatter} with the provided {@link ChatGptService}.
15+
*
16+
* @param chatGptService the {@link ChatGptService} used for formatting code
17+
*/
1018
public ChatGPTFormatter(ChatGptService chatGptService) {
1119
this.chatGptService = chatGptService;
1220
}
1321

22+
/**
23+
* Formats the provided code using ChatGPT.
24+
*
25+
* @param code the code to be formatted
26+
* @return an Optional containing the formatted code if successful, empty otherwise
27+
*/
1428
public Optional<String> format(CharSequence code) {
1529
return chatGptService.formatCode(code);
1630
}

application/src/main/java/org/togetherjava/tjbot/features/code/FormatCodeCommand.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ public MessageEmbed apply(CodeFence codeFence) {
4040
.build();
4141
}
4242

43+
/**
44+
* Formats the provided code using either the ChatGPT formatter or the generic formatter.
45+
*
46+
* @param code the code to be formatted
47+
* @return the formatted code
48+
*/
4349
private String formatCode(CharSequence code) {
4450
return chatGPTFormatter.format(code).orElse(formatter.format(code));
4551
}

0 commit comments

Comments
 (0)