generated from Kord-Extensions/template
-
Notifications
You must be signed in to change notification settings - Fork 24
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
Log improvements #75
Merged
Merged
Log improvements #75
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4624839
Make mods aware of their location
Jamalam360 e4fe355
Add processor to request crash reports
Jamalam360 7314a79
Add fabric apis on quilt processor
Jamalam360 7ced10d
Add the two new processors
Jamalam360 d50d0d4
Fix some names
Jamalam360 0b5ec2f
Update regexes
Jamalam360 3835b50
Update regexes
Jamalam360 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...rc/main/kotlin/org/quiltmc/community/cozy/modules/logs/processors/CrashReportProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.quiltmc.community.cozy.modules.logs.processors | ||
|
||
import dev.kord.core.event.Event | ||
import org.quiltmc.community.cozy.modules.logs.data.Log | ||
import org.quiltmc.community.cozy.modules.logs.data.Order | ||
import org.quiltmc.community.cozy.modules.logs.types.LogProcessor | ||
|
||
private val CRASH_REPORT_REGEX = "Crashed! The full crash report has been saved to (\\S+)" | ||
.toRegex(RegexOption.IGNORE_CASE) | ||
|
||
public class CrashReportProcessor : LogProcessor() { | ||
override val identifier: String = "crash-reports" | ||
override val order: Order = Order.Default | ||
|
||
override suspend fun predicate(log: Log, event: Event): Boolean = | ||
CRASH_REPORT_REGEX.find(log.content) != null | ||
|
||
override suspend fun process(log: Log) { | ||
val match = CRASH_REPORT_REGEX.find(log.content) ?: return | ||
log.addMessage("Please also provide the crash report at `${match.groups[1]!!.value}`") | ||
Jamalam360 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
...in/kotlin/org/quiltmc/community/cozy/modules/logs/processors/quilt/FabricApisProcessor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.quiltmc.community.cozy.modules.logs.processors.quilt | ||
|
||
import dev.kord.core.event.Event | ||
import org.quiltmc.community.cozy.modules.logs.data.LoaderType | ||
import org.quiltmc.community.cozy.modules.logs.data.Log | ||
import org.quiltmc.community.cozy.modules.logs.data.Order | ||
import org.quiltmc.community.cozy.modules.logs.types.LogProcessor | ||
|
||
public class FabricApisProcessor : LogProcessor() { | ||
override val identifier: String = "quilt-fabric-apis" | ||
override val order: Order = Order.Default | ||
|
||
override suspend fun predicate(log: Log, event: Event): Boolean = | ||
log.getLoaderVersion(LoaderType.Quilt) != null | ||
|
||
override suspend fun process(log: Log) { | ||
val fabricApi = log.getMod("fabric") | ||
val fabricLanguageKotlin = log.getMod("fabric-language-kotlin") | ||
|
||
if (fabricApi != null) { | ||
log.hasProblems = true | ||
|
||
log.addMessage( | ||
"Fabric API is present at `${fabricApi.path}`, and should be replaced by [QSL](https://modrinth.com/mod/qsl)" | ||
) | ||
} | ||
|
||
if (fabricLanguageKotlin != null) { | ||
log.hasProblems = true | ||
|
||
log.addMessage( | ||
"Fabric Language Kotlin is present at `${fabricLanguageKotlin.path}`, " + | ||
"and should be replaced by [QKL](https://modrinth.com/mod/qkl)" | ||
) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be replaced with a kotlin raw string to reduce the amount of escaping ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably. I don't think any other regexes use that but it would be an improvement to change them all
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but if any of them use
$
we have to use this ugliness"""${'$'}"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wait until you hear about kotlin backtick escaping allowing$`$`
by referencing a variable instead of the long escapeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a blocking issue for this PR?