Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion botfest/src/main/kotlin/net/modfest/botfest/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import com.google.gson.Gson
import com.google.gson.JsonElement
import com.google.gson.JsonPrimitive
import dev.kord.common.entity.Snowflake
import dev.kord.rest.builder.message.allowedMentions
import dev.kord.rest.builder.message.embed
import dev.kordex.core.ExtensibleBot
import dev.kordex.core.i18n.withContext
import dev.kordex.core.utils.env
import dev.kordex.core.utils.envOrNull
import dev.kordex.core.utils.loadModule
Expand All @@ -29,6 +29,10 @@ private val TOKEN = env("TOKEN") // Get the bot's token from the env vars or a

suspend fun main() {
val bot = ExtensibleBot(TOKEN) {
kord {
stackTraceRecovery = devMode
}

hooks {
beforeKoinSetup {
loadModule {
Expand Down Expand Up @@ -56,6 +60,8 @@ suspend fun main() {
}

errorResponse { message, type ->
allowedMentions { }

if (type.error is PlatformException) {
var data = (type.error as PlatformException).data
content = when (data.type) {
Expand All @@ -73,6 +79,8 @@ suspend fun main() {
PlatformErrorResponse.ErrorType.INTERNAL -> Translations.Apierror.internal
.translateNamed("error" to data.data.stringified())
}
} else {
content = message.translate()
}
}

Expand Down
8 changes: 8 additions & 0 deletions botfest/src/main/kotlin/net/modfest/botfest/Platform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import net.modfest.platform.pojo.EventData
import net.modfest.platform.pojo.HealthData
import net.modfest.platform.pojo.MinecraftEditResponse
import net.modfest.platform.pojo.PlatformErrorResponse
import net.modfest.platform.pojo.SubmissionData.BoothData
import net.modfest.platform.pojo.SubmissionPatchData
import net.modfest.platform.pojo.SubmissionResponseData
import net.modfest.platform.pojo.SubmitRequestModrinth
Expand Down Expand Up @@ -209,6 +210,13 @@ class PlatformAuthenticated(var client: HttpClient, var discordUser: Snowflake)
}.unwrapErrors().body()
}

suspend fun editSubmissionBoothData(eventId: String, subId: String, edit: BoothData): SubmissionResponseData {
return client.patch("/event/$eventId/booth/$subId") {
addAuth()
setBody(edit)
}.unwrapErrors().body()
}

suspend fun updateSubmissionVersion(eventId: String, subId: String): SubmissionResponseData {
return client.put("/event/$eventId/submission/$subId/updateVersion") {
addAuth()
Expand Down
Loading
Loading