Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging the /tag-manage command #296

Merged
merged 77 commits into from
Mar 14, 2022
Merged
Changes from 1 commit
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
eb273b9
`minor fix`
Dec 2, 2021
b0ce95d
fixed auto-checked problems
Dec 3, 2021
e06af67
`minor fix`
Dec 3, 2021
5545a72
added `content.md` files to the logs and optimized logging methods to…
Dec 3, 2021
3c8c59c
removed duplicate `getTextChannels()`
Dec 3, 2021
202e117
made `log()` `synchronized` to prevent interruptions
Dec 3, 2021
a4447cf
made `enum Filename`
Dec 3, 2021
ccbaecb
files are now in the same message as the embed
Dec 4, 2021
b9f98fa
changed `oldContent` to `previousContent`
Dec 4, 2021
a78c039
changed `class VirtualFile` to `record Attachment`
Dec 4, 2021
40ce619
made `class ModAuditLogWriter` an `enum`
Dec 4, 2021
4bfb896
fixed minor code-style problems
Dec 4, 2021
d7e3ccf
improved the structure of `ModAuditLogWriter#log()`
Dec 5, 2021
60e328b
merged the 3 logging methods in `TagManageCommand`
Dec 5, 2021
123aa43
now using `Optional#orElseThrow()` instead of `Optional#get()`
Dec 5, 2021
d5438e6
changed error message `"Shouldn't log subcommand"`
Dec 5, 2021
c4e752b
made arrays `@NotNull`
Dec 5, 2021
e94a720
replaced `Filename` enum with constants
Dec 7, 2021
3c9658e
now checking for `null` instead of abusing Optionals
Dec 7, 2021
81b43b3
`ModAuditLogWriter#log` now takes the attachments as a List instead o…
Dec 7, 2021
e9e4a25
updated a minor javadoc
Dec 7, 2021
35411af
renamed `ModAuditLogWriter#log()` to `writeModAuditLog()`
Dec 7, 2021
b462051
changed the embed color from `#4FC3F7` to `#3788AC`
Dec 7, 2021
d0f3340
removed duplicate `getModAuditLogChannel()`
Dec 7, 2021
3e3a7b6
now ignores `NoSuchElementException`
Dec 7, 2021
70c680c
`actionVerb` is now a field in `Subcommand` enum
Dec 7, 2021
64aaab4
removed unused field and var
Dec 7, 2021
91a968d
moved duplicate debug message
Dec 7, 2021
6f6a342
removed static import
interacsion Dec 24, 2021
ae123c5
Improved JavaDoc.
interacsion Jan 20, 2022
b23e7f5
Added missing imports
interacsion Jan 21, 2022
54c9daf
removed `static final` from `record`
interacsion Jan 21, 2022
071fc9b
Slightly updated previous content retrieval code
interacsion Jan 21, 2022
b494b75
now using `EnumSet` instead of `List`
interacsion Jan 21, 2022
5bc61ff
made `logAction()` fail-fast
interacsion Jan 21, 2022
358057c
removed unnecessary constructor
interacsion Jan 21, 2022
4377d89
made `Subcommand` enum methods `@NotNull`
interacsion Jan 21, 2022
6eb5898
moved predicates directly into the variable declaration
interacsion Jan 21, 2022
e8a7f0b
updated `Attachment` `record`
interacsion Jan 21, 2022
7c6823d
moved the code that gets previous content into a helper method, getTa…
interacsion Jan 21, 2022
a221436
now using `actionVerb` as the verb in the message
interacsion Jan 21, 2022
24def34
renamed `writeModAuditLog()` to `write`
interacsion Jan 21, 2022
7c49c73
removed `write()` overloads and now getting attachments as a vararg
interacsion Jan 21, 2022
a9a4339
renamed `getModAuditLogChannel()` to `getAndHandleModAuditLogChannel()`
interacsion Jan 21, 2022
81482cd
fixed code-style.
interacsion Jan 21, 2022
1a8b799
fixed a merge issue
interacsion Jan 26, 2022
429d9b7
using constant `CONTENT_FILE_NAME` instead of `"content.md"`
interacsion Jan 27, 2022
d011b34
Now using a constant for the log embed description
interacsion Jan 27, 2022
3b9b8b9
code-style quick fix
interacsion Jan 27, 2022
749db7b
moved comment to be above the constant, instead of in front of it.
interacsion Jan 27, 2022
7d25c29
Put audit log channel name pattern in a field
interacsion Jan 27, 2022
97c4f32
renamed field.
interacsion Jan 27, 2022
1cf7627
spotless applied.
interacsion Jan 28, 2022
ccac112
Removed useless imports.
interacsion Feb 9, 2022
f00590a
Updated `getTagContent()`
interacsion Mar 2, 2022
e848ac0
Some code changes
interacsion Mar 11, 2022
4d1f09a
Updated `ModAuditLogWriter`'s javadoc
interacsion Mar 11, 2022
4d55f1f
changed variable name
interacsion Mar 11, 2022
f8f6608
updated `getTagContent()`
interacsion Mar 11, 2022
86b93e5
Moved enum set into a variable.
interacsion Mar 11, 2022
2521bcb
code reformat
interacsion Mar 11, 2022
1a67ae9
code reformat
interacsion Mar 11, 2022
f036077
moved field and var into `Subcommand`
interacsion Mar 11, 2022
7b101c6
made fields `private`
interacsion Mar 11, 2022
4b20e3c
removed unnecessary `this.`
interacsion Mar 11, 2022
da0b177
Rebased and made `ModAuditLogWriter` singleton
interacsion Mar 11, 2022
ddc1b88
Using a `BiConsumer` to minimize code duplication.
interacsion Mar 11, 2022
2661399
`getTagContent()` is now returning `null`
interacsion Mar 11, 2022
f6ad120
Made test compile again
interacsion Mar 11, 2022
1f493f3
now verifying wanted results in tests
interacsion Mar 11, 2022
a3692ba
quick patch
interacsion Mar 12, 2022
7a812b7
Updated `Unable to retrieve content` handling
interacsion Mar 12, 2022
4a19004
made `auditLogChannelNamePattern` compile in constructor
interacsion Mar 12, 2022
279d3aa
changed `logAction()` logic
interacsion Mar 12, 2022
7639f71
Updated `getTagContent()` javadoc
interacsion Mar 12, 2022
2111dc8
replaced `ArrayList` with `List`
interacsion Mar 12, 2022
cf98c4a
put predicate in the field instead of the pattern
interacsion Mar 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private void handleActionWithMessage(@NotNull TagStatus requiredTagStatus,
* @param id the id of the tag to get its content
* @return the content of the tag, or {@code "Unable to retrieve content"} if was unable to
Zabuzard marked this conversation as resolved.
Show resolved Hide resolved
*/
private @NotNull String getTagContent(@NotNull Subcommand subcommand, @NotNull String id) {
private @Nullable String getTagContent(@NotNull Subcommand subcommand, @NotNull String id) {
Zabuzard marked this conversation as resolved.
Show resolved Hide resolved
if (Subcommand.SUBCOMMANDS_WITH_PREVIOUS_CONTENT.contains(subcommand)) {
try {
return tagSystem.getTag(id).orElseThrow();
Expand All @@ -319,7 +319,7 @@ private void handleActionWithMessage(@NotNull TagStatus requiredTagStatus,
}
}

return "Unable to retrieve content";
return null;
}

/**
Expand Down