@@ -9,7 +9,6 @@ import dev.kordex.core.commands.application.slash.ephemeralSubCommand
99import dev.kordex.core.commands.application.slash.group
1010import dev.kordex.core.commands.converters.impl.attachment
1111import dev.kordex.core.commands.converters.impl.string
12- import dev.kordex.core.commands.converters.impl.user
1312import dev.kordex.core.components.components
1413import dev.kordex.core.components.ephemeralStringSelectMenu
1514import dev.kordex.core.components.forms.ModalForm
@@ -339,143 +338,6 @@ class SubmissionCommands : Extension(), KordExKoinComponent {
339338 }
340339 }
341340
342- // Leave submission
343- unsafeSubCommand(::SubmissionArg ) {
344- name = Translations .Commands .Submission .Leave .name
345- description = Translations .Commands .Submission .Leave .description
346-
347- initialResponse = InitialSlashCommandResponse .None
348-
349- action {
350- val subId = this .arguments.submission
351- val curEvent = platform.getCurrentEvent().event
352- if (curEvent == null ) {
353- ackEphemeral {
354- content = Translations .Commands .Event .Submit .Response .unavailable
355- .withContext(this @action)
356- .translateNamed()
357- }
358- return @action
359- }
360-
361- val submission = platform.getUserSubmissions(this .user.id).find { it.id == subId }
362-
363- if (submission == null ) {
364- ackEphemeral {
365- content = Translations .Commands .Submission .Leave .Response .notfound
366- .withContext(this @action)
367- .translateNamed(
368- " subId" to subId
369- )
370- }
371- return @action
372- }
373-
374- if (! submission.authors.contains(this .user.id.value.toString())) {
375- ackEphemeral {
376- content = Translations .Commands .Submission .Leave .Response .notfound
377- .withContext(this @action)
378- .translateNamed(
379- " subId" to subId
380- )
381- }
382- return @action
383- }
384-
385- if (submission.authors.size < 2 ) {
386- ackEphemeral {
387- content = Translations .Commands .Submission .Leave .Response .last
388- .withContext(this @action)
389- .translateNamed(
390- " subId" to subId
391- )
392- }
393- return @action
394- }
395-
396- platform.withAuth(this .user).leaveSubmission(curEvent, subId)
397-
398- ackEphemeral {
399- content = Translations .Commands .Submission .Leave .Response .success
400- .withContext(this @action)
401- .translateNamed(
402- " subId" to subId
403- )
404- }
405- }
406- }
407-
408- // Invite user to submission
409- unsafeSubCommand(::InviteSubmissionArgs ) {
410- name = Translations .Commands .Submission .Leave .name
411- description = Translations .Commands .Submission .Leave .description
412-
413- initialResponse = InitialSlashCommandResponse .None
414-
415- action {
416- val subId = this .arguments.submission
417- val userId = this .arguments.user;
418- val curEvent = platform.getCurrentEvent().event
419- if (curEvent == null ) {
420- ackEphemeral {
421- content = Translations .Commands .Event .Submit .Response .unavailable
422- .withContext(this @action)
423- .translateNamed()
424- }
425- return @action
426- }
427-
428- val submission = platform.getUserSubmissions(this .user.id).find { it.id == subId }
429-
430- if (submission == null ) {
431- ackEphemeral {
432- content = Translations .Commands .Submission .Invite .Response .notfound
433- .withContext(this @action)
434- .translateNamed(
435- " subId" to subId
436- )
437- }
438- return @action
439- }
440-
441- val author = platform.getUser(this .arguments.user)
442-
443- if (author == null ) {
444- ackEphemeral {
445- content = Translations .Commands .Submission .Invite .Response .usernotfound
446- .withContext(this @action)
447- .translateNamed(
448- " userId" to userId
449- )
450- }
451- return @action
452- }
453-
454- if (submission.authors.contains(author.id)) {
455- ackEphemeral {
456- content = Translations .Commands .Submission .Invite .Response .already
457- .withContext(this @action)
458- .translateNamed(
459- " subId" to subId,
460- " userId" to userId
461- )
462- }
463- return @action
464- }
465-
466- platform.withAuth(this .user).inviteSubmissionAuthor(curEvent, subId, author.id)
467-
468- ackEphemeral {
469- content = Translations .Commands .Submission .Invite .Response .success
470- .withContext(this @action)
471- .translateNamed(
472- " subId" to subId,
473- " userId" to userId
474- )
475- }
476- }
477- }
478-
479341 // Edit submissions images
480342 group(Translations .Commands .Submission .EditImage .label) {
481343 description = Translations .Commands .Submission .EditImage .description
@@ -535,26 +397,6 @@ class SubmissionCommands : Extension(), KordExKoinComponent {
535397 }
536398 }
537399
538- open inner class InviteSubmissionArgs : Arguments () {
539- val submission by string {
540- name = Translations .Arguments .Submission .Edit .name
541- description = Translations .Arguments .Submission .Edit .description
542-
543- autoComplete {
544- val curEvent = platform.getCurrentEvent().event ? : return @autoComplete
545- suggestStringCollection(
546- platform.getUserSubmissions(this .user.id)
547- .filter { it.event == curEvent }
548- .map { it.id }
549- )
550- }
551- }
552- val user by user {
553- name = Translations .Arguments .Submission .Invite .User .name
554- description = Translations .Arguments .Submission .Invite .User .description
555- }
556- }
557-
558400 open inner class SubmissionArg : Arguments () {
559401 val submission by string {
560402 name = Translations .Arguments .Submission .Edit .name
0 commit comments