Skip to content

Commit c10c5ae

Browse files
committed
allow other modrinth projects on the modrinth type
1 parent 6874be1 commit c10c5ae

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import dev.kord.core.behavior.interaction.response.edit
55
import dev.kordex.core.commands.Arguments
66
import dev.kordex.core.commands.application.slash.EphemeralSlashCommand
77
import dev.kordex.core.commands.application.slash.EphemeralSlashCommandContext
8-
import dev.kordex.core.commands.application.slash.converters.impl.stringChoice
98
import dev.kordex.core.commands.application.slash.ephemeralSubCommand
109
import dev.kordex.core.commands.application.slash.group
1110
import dev.kordex.core.commands.converters.impl.attachment
@@ -47,7 +46,7 @@ class SubmissionCommands : Extension(), KordExKoinComponent {
4746
override val name = "submission"
4847
val platform: Platform by inject()
4948

50-
var MODRINTH_REGEX = Pattern.compile(".*modrinth\\.com/mod/([\\w!@$()`.+,\"\\-']{3,64})/?.*");
49+
var MODRINTH_REGEX = Pattern.compile(".*modrinth\\.com/(project|mod|resourcepack|datapack|shader|plugin|modpack)/([\\w!@$()`.+,\"\\-']{3,64})/?.*")
5150

5251
@OptIn(UnsafeAPI::class, ExperimentalSerializationApi::class)
5352
override suspend fun setup() {
@@ -468,7 +467,7 @@ class SubmissionCommands : Extension(), KordExKoinComponent {
468467
}
469468

470469
class SubmitModalEvent : ModalForm() {
471-
override var title: Key = Translations.Modal.Submit.Event.title;
470+
override var title: Key = Translations.Modal.Submit.Event.title
472471

473472
val event_title = lineText {
474473
label = Translations.Modal.Submit.Event.Title.label

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ modal.register.pronouns.label=What are your preferred pronouns?
116116
modal.register.pronouns.placeholder=they/them
117117
modal.submit.title=Submit a mod
118118
modal.submit.url.label=Enter your project's Modrinth URL
119-
modal.submit.url.placeholder=https://modrinth.com/mod/your-mod
119+
modal.submit.url.placeholder=https://modrinth.com/project/slug
120120
modal.submission.edit.title=Edit your mod's data
121121
modal.submission.name.label=Name
122122
modal.submission.name.placeholder=My mod

platform_api/src/main/java/net/modfest/platform/service/SubmissionService.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public SubmissionData makeSubmissionOther(EventData event, Set<UserData> authors
108108
event.id(),
109109
submitData.name(),
110110
submitData.description(),
111-
authors.stream().map(a -> a.id()).collect(Collectors.toSet()),
111+
authors.stream().map(UserData::id).collect(Collectors.toSet()),
112112
new SubmissionData.AssociatedData(
113113
new SubmissionData.AssociatedData.Other(
114114
submitData.homepage(),
@@ -138,10 +138,6 @@ public SubmissionData makeSubmissionModrinth(String eventId, String mrProjectId)
138138
var authors = getUsersForRinthProject(subId);
139139
var latest = getLatestModrinth(subId, eventService.getEventById(eventId));
140140

141-
if (latest == null) {
142-
throw new RuntimeException("No latest version");
143-
}
144-
145141
imageService.downloadSubmissionImage(project.iconUrl, subKey, ImageService.SubmissionImageType.ICON);
146142
var galleryUrl = getGalleryUrl(project);
147143
if (galleryUrl != null) {
@@ -157,7 +153,7 @@ public SubmissionData makeSubmissionModrinth(String eventId, String mrProjectId)
157153
new SubmissionData.AssociatedData(
158154
new SubmissionData.AssociatedData.Modrinth(
159155
project.id,
160-
latest.id
156+
latest == null ? null : latest.id
161157
)
162158
),
163159
project.sourceUrl,

0 commit comments

Comments
 (0)