feat: Messages

This commit is contained in:
2025-03-03 23:22:48 +03:00
parent bd87ca2729
commit 23780489f6
7 changed files with 357 additions and 157 deletions
@@ -1,7 +1,7 @@
/*
* Created by sweetbread
* Copyright (c) 2025. All rights reserved.
* Last modified 22.02.2025, 19:52
* Last modified 03.03.2025, 18:28
*/
package ru.risdeveau.pixeldragon.api
@@ -54,4 +54,10 @@ private suspend fun getState(rid: String, state: String, key: String): String? {
val json = JSONObject(r.bodyAsText())
if (!json.has(key)) return null
return json.getString(key)
}
}
suspend fun getAccountData(user: String, room: String, state: String): JSONObject? {
val r = client.get("$baseUrl/user/$user/rooms/$room/account_data/$state") { bearerAuth(token) }
if (r.status != HttpStatusCode.OK) return null
return JSONObject(r.bodyAsText())
}