Skip to content

Commit 67f6b35

Browse files
committed
move minecraft commands around so they parse
1 parent 48cdd5b commit 67f6b35

2 files changed

Lines changed: 30 additions & 23 deletions

File tree

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

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package net.modfest.botfest.extensions
22

33
import dev.kordex.core.commands.Arguments
44
import dev.kordex.core.commands.application.slash.ephemeralSubCommand
5+
import dev.kordex.core.commands.application.slash.group
56
import dev.kordex.core.commands.converters.impl.optionalString
67
import dev.kordex.core.commands.converters.impl.string
78
import dev.kordex.core.extensions.Extension
@@ -49,34 +50,38 @@ class UserCommands : Extension(), KordExKoinComponent {
4950
}
5051
}
5152

52-
// Allows the user to add a minecraft username
53-
ephemeralSubCommand(::MinecraftUsernameArgs) {
54-
name = Translations.Commands.User.Minecraft.Add.name
55-
description = Translations.Commands.User.Minecraft.Add.description
53+
group(Translations.Commands.Group.User.Minecraft.name) {
54+
description = Translations.Commands.Group.User.Minecraft.description
5655

57-
action {
58-
platform.withAuth(this.user).addMinecraft(this.arguments.username)
56+
// Allows the user to add a minecraft username
57+
ephemeralSubCommand(::MinecraftUsernameArgs) {
58+
name = Translations.Commands.User.Minecraft.Add.name
59+
description = Translations.Commands.User.Minecraft.Add.description
5960

60-
respond {
61-
content = Translations.Commands.User.Minecraft.Add.response
62-
.withContext(this@action)
63-
.translateNamed()
61+
action {
62+
platform.withAuth(this.user).addMinecraft(this.arguments.username)
63+
64+
respond {
65+
content = Translations.Commands.User.Minecraft.Add.response
66+
.withContext(this@action)
67+
.translateNamed()
68+
}
6469
}
6570
}
66-
}
6771

68-
// Allows the user to remove a minecraft username
69-
ephemeralSubCommand(::MinecraftUsernameArgs) {
70-
name = Translations.Commands.User.Minecraft.Remove.name
71-
description = Translations.Commands.User.Minecraft.Remove.description
72+
// Allows the user to remove a minecraft username
73+
ephemeralSubCommand(::MinecraftUsernameArgs) {
74+
name = Translations.Commands.User.Minecraft.Remove.name
75+
description = Translations.Commands.User.Minecraft.Remove.description
7276

73-
action {
74-
platform.withAuth(this.user).removeMinecraft(this.arguments.username)
77+
action {
78+
platform.withAuth(this.user).removeMinecraft(this.arguments.username)
7579

76-
respond {
77-
content = Translations.Commands.User.Minecraft.Remove.response
78-
.withContext(this@action)
79-
.translateNamed()
80+
respond {
81+
content = Translations.Commands.User.Minecraft.Remove.response
82+
.withContext(this@action)
83+
.translateNamed()
84+
}
8085
}
8186
}
8287
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ commands.group.event.name=event
88
commands.group.event.description=Do things related to the current event
99
commands.group.submission.name=submission
1010
commands.group.submission.description=Manage your submissions to the current event
11+
commands.group.user.minecraft.name=minecraft
12+
commands.group.user.minecraft.description=Manage the minecraft accounts associated with your profile
1113

1214
commands.getcurrentevent.name=GetCurrentEvent
1315
commands.getcurrentevent.description=Gets the current event
@@ -48,10 +50,10 @@ commands.whoami.response=\
4850
commands.user.set.name=set
4951
commands.user.set.description=Change information on your profile
5052
commands.user.set.response=Successfully changed data
51-
commands.user.minecraft.add.name=minecraft add
53+
commands.user.minecraft.add.name=add
5254
commands.user.minecraft.add.description=Associate a minecraft username with your profile
5355
commands.user.minecraft.add.response=Successfully added {username} ({uuid}) to your user.
54-
commands.user.minecraft.remove.name=minecraft remove
56+
commands.user.minecraft.remove.name=remove
5557
commands.user.minecraft.remove.description=Remove a minecraft username from your profile
5658
commands.user.minecraft.remove.response=Successfully removed {username} ({uuid}) from your user.
5759
commands.register.name=Register

0 commit comments

Comments
 (0)