File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
common/src/main/kotlin/com/lambda Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -24,9 +24,11 @@ import com.lambda.brigadier.execute
2424import com.lambda.brigadier.required
2525import com.lambda.command.LambdaCommand
2626import com.lambda.module.modules.client.Discord.partyCreate
27+ import com.lambda.module.modules.client.Discord.partyDelete
2728import com.lambda.module.modules.client.Discord.partyJoin
2829import com.lambda.module.modules.client.Discord.partyLeave
2930import com.lambda.module.modules.client.Discord.rpc
31+ import com.lambda.network.api.v1.endpoints.deleteParty
3032import com.lambda.network.api.v1.endpoints.leaveParty
3133import com.lambda.threading.runConcurrent
3234import com.lambda.threading.runSafe
@@ -52,7 +54,7 @@ object DiscordCommand : LambdaCommand(
5254
5355 required(literal(" delete" )) {
5456 execute {
55- runSafe { partyCreate () }
57+ runSafe { partyDelete () }
5658 }
5759 }
5860
Original file line number Diff line number Diff line change @@ -140,6 +140,20 @@ object Discord : Module(
140140 currentParty = null
141141 }
142142
143+ /* *
144+ * Deletes the current party
145+ */
146+ fun SafeContext.partyDelete () {
147+ if (! isDiscordLinked) return warn(" You did not link your discord account" )
148+ if (! player.isInParty) return warn(" You are not in a party" )
149+
150+ val (_, error) = deleteParty()
151+ if (error != null ) return warn(" Failed to delete the party: ${error.errorData} " )
152+
153+ currentParty = null
154+
155+ }
156+
143157 private suspend fun start () {
144158 if (rpc.connected) return
145159
You can’t perform that action at this time.
0 commit comments