Skip to content

Commit eeabe68

Browse files
committed
Merge branch 'dev' into webhooks
2 parents 9f1ce3d + 93329d9 commit eeabe68

File tree

4 files changed

+74
-3
lines changed

4 files changed

+74
-3
lines changed

botfest/src/main/kotlin/net/modfest/botfest/extensions/SubmissionCommands.kt

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import kotlinx.serialization.json.putJsonArray
3737
import net.modfest.botfest.MAIN_GUILD_ID
3838
import net.modfest.botfest.Platform
3939
import net.modfest.botfest.i18n.Translations
40+
import net.modfest.platform.pojo.EventData
4041
import net.modfest.platform.pojo.SubmissionData.AssociatedData.Modrinth
4142
import net.modfest.platform.pojo.SubmissionData.AssociatedData.Other
4243
import net.modfest.platform.pojo.SubmissionData.BoothData
@@ -632,7 +633,50 @@ class SubmissionCommands : Extension(), KordExKoinComponent {
632633
description = Translations.Commands.Submission.Test.description
633634

634635
action {
635-
imageCommandAction("test")
636+
val subId = this.arguments.submission
637+
val curEvent = platform.getCurrentEvent().event
638+
if (curEvent == null) {
639+
respond {
640+
content = Translations.Commands.Submit.Response.unavailable
641+
.withContext(this@action)
642+
.translateNamed()
643+
}
644+
return@action
645+
}
646+
647+
val event = platform.getEvent(curEvent)
648+
649+
if (event.phase in setOf(EventData.Phase.PLANNING, EventData.Phase.MODDING)) {
650+
respond {
651+
content = Translations.Commands.Submission.Test.Response.early
652+
.withContext(this@action)
653+
.translateNamed()
654+
}
655+
return@action
656+
}
657+
658+
val submission = platform.getEventSubmissions(curEvent).find { it.id == subId }
659+
660+
if (submission == null) {
661+
respond {
662+
content = Translations.Commands.Submission.Edit.Response.notfound
663+
.withContext(this@action)
664+
.translateNamed(
665+
"subId" to subId
666+
)
667+
}
668+
return@action
669+
}
670+
671+
platform.withAuth(this.user).editSubmissionImage(curEvent, subId, "test", this.arguments.image.url)
672+
673+
respond {
674+
content = Translations.Commands.Submission.Test.Response.success
675+
.withContext(this@action)
676+
.translateNamed(
677+
"subId" to subId
678+
)
679+
}
636680
}
637681
}
638682

@@ -652,6 +696,17 @@ class SubmissionCommands : Extension(), KordExKoinComponent {
652696
return@action
653697
}
654698

699+
val event = platform.getEvent(curEvent)
700+
701+
if (event.phase in setOf(EventData.Phase.PLANNING, EventData.Phase.MODDING)) {
702+
respond {
703+
content = Translations.Commands.Submission.Claim.Response.early
704+
.withContext(this@action)
705+
.translateNamed()
706+
}
707+
return@action
708+
}
709+
655710
val submission = platform.getEventSubmissions(curEvent).find { it.id == subId }
656711

657712
if (submission == null) {
@@ -751,6 +806,17 @@ class SubmissionCommands : Extension(), KordExKoinComponent {
751806
return@action
752807
}
753808

809+
val event = platform.getEvent(curEvent)
810+
811+
if (event.phase in setOf(EventData.Phase.PLANNING, EventData.Phase.MODDING, EventData.Phase.TESTING)) {
812+
respond {
813+
content = Translations.Commands.Submission.Build.Response.early
814+
.withContext(this@action)
815+
.translateNamed()
816+
}
817+
return@action
818+
}
819+
754820
val submission = platform.getEventSubmissions(curEvent).find { it.id == subId }
755821

756822
if (submission == null) {

botfest/src/main/resources/translations/botfest/strings.properties

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,18 @@ commands.submission.invite.response.usernotfound=Unknown user {userId}
122122
commands.submission.invite.response.already=User {userId} is already associated with {subId}!
123123
commands.submission.invite.response.success=Successfully added user {userId} to {subId}
124124
commands.submission.test.name=test
125-
commands.submission.test.description=Submit or update your test lot
125+
commands.submission.test.description=Submit or update your testing phase screenshot ("test lot")
126+
commands.submission.test.response.early=The testing phase hasn't started yet! Test lots must be created on the event test server to check for incompatibilities.
127+
commands.submission.test.response.success=Updated {subId} with new proof of testing!
126128
commands.submission.claim.name=claim
127129
commands.submission.claim.description=Submit or update your booth claim
130+
commands.submission.claim.response.early=The claiming phase hasn't started yet! Claims are only valid once they've been built on the build server.
128131
commands.submission.claim.response.incomplete=Incomplete submission rejected! you must fill ALL arguments when initially submitting your claim.
129132
commands.submission.claim.response.unchanged=No arguments entered - nothing changed!
130133
commands.submission.claim.response.success=Updated {subId} with new claim data!
131134
commands.submission.build.name=build
132135
commands.submission.build.description=Submit or update your booth build info
136+
commands.submission.build.response.early=The building phase hasn't started yet! No booth building is permitted before this point.
133137
commands.submission.build.response.incomplete=Incomplete submission rejected! you must fill ALL arguments when initially submitting your build.
134138
commands.submission.build.response.unchanged=No arguments entered - nothing changed!
135139
commands.submission.build.response.success=Updated {subId} with new build data!

common/src/main/java/net/modfest/platform/pojo/EventData.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public enum Type {
2626
public enum Phase {
2727
PLANNING(true, false, false),
2828
MODDING(true, true, true),
29+
TESTING(false, false, true),
2930
BUILDING(false, false, true),
3031
SHOWCASE(false, false, false),
3132
COMPLETE(false, false, false);

panel/src/platform_types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ export interface Whoami {
164164
permissions: string[];
165165
}
166166

167-
export type EventData$Phase = "planning" | "modding" | "building" | "showcase" | "complete";
167+
export type EventData$Phase = "planning" | "modding" | "testing" | "building" | "showcase" | "complete";
168168

169169
export type EventData$Type = "modfest" | "blanketcon";
170170

0 commit comments

Comments
 (0)