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

MessageLogger PluralKit Compatibility #34

Open
KiARC opened this issue Aug 6, 2022 · 0 comments
Open

MessageLogger PluralKit Compatibility #34

KiARC opened this issue Aug 6, 2022 · 0 comments

Comments

@KiARC
Copy link

KiARC commented Aug 6, 2022

To help make sure that PluralKit doesn't jam up the log with unnecessary messages, maybe you could run every message through this before logging it:

fun isProxyTrigger(id: String): Boolean {
  val client = HttpClient.newBuilder().build()
  val request = HttpRequest.newBuilder().uri(URI.create("https://api.PluralKit.me/v2/messages/"+id)).build()
  val response = StringBuilder(client.send(request, HttpResponse.BodyHandlers.ofString()).body())
  val json: JsonObject = Parser.default().parse(response) as JsonObject
  return if (json.int("code") != null) false else json.string("id") != id
}

If the result is true just don't log it. Additionally don't log messages matching the regex /pk;e.*/i to eliminate message-edit commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant