-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed private commands showing up outside of mainland guild
- Loading branch information
Showing
6 changed files
with
109 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...ain/kotlin/hub/nebula/pangea/command/vanilla/dev/LavalinkForceReconnectCommandExecutor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package hub.nebula.pangea.command.vanilla.dev | ||
|
||
import hub.nebula.pangea.command.PangeaInteractionContext | ||
import hub.nebula.pangea.command.structure.PangeaSlashCommandExecutor | ||
import hub.nebula.pangea.listener.MajorEventListener | ||
|
||
class LavalinkForceReconnectCommandExecutor : PangeaSlashCommandExecutor() { | ||
override suspend fun execute(context: PangeaInteractionContext) { | ||
if (context.user.idLong != 236167700777271297L) { | ||
context.reply(true) { | ||
content = "Nope." | ||
} | ||
return | ||
} | ||
|
||
context.pangea.lavakord.nodes.forEach { | ||
context.pangea.lavakord.removeNode(it) | ||
} | ||
|
||
MajorEventListener.connectLavalinkNode(context.pangea) | ||
|
||
context.reply { | ||
content = "Reconnected." | ||
} | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...main/kotlin/hub/nebula/pangea/command/vanilla/dev/UnregisterAllCommandsCommandExecutor.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package hub.nebula.pangea.command.vanilla.dev | ||
|
||
import dev.minn.jda.ktx.coroutines.await | ||
import hub.nebula.pangea.command.PangeaInteractionContext | ||
import hub.nebula.pangea.command.structure.PangeaSlashCommandExecutor | ||
|
||
class UnregisterAllCommandsCommandExecutor : PangeaSlashCommandExecutor() { | ||
override suspend fun execute(context: PangeaInteractionContext) { | ||
if (context.user.idLong != 236167700777271297L) { | ||
context.reply(true) { | ||
content = "Nope." | ||
} | ||
return | ||
} | ||
|
||
val allCommands = context.jda.retrieveCommands().await() | ||
|
||
allCommands.forEach { | ||
it.delete().await() | ||
} | ||
|
||
context.reply { | ||
content = "Unregistered all ${allCommands.size} commands." | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/hub/nebula/pangea/command/vanilla/dev/declaration/ToolsCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package hub.nebula.pangea.command.vanilla.dev.declaration | ||
|
||
import hub.nebula.pangea.command.structure.PangeaSlashCommandDeclarationWrapper | ||
import hub.nebula.pangea.command.vanilla.dev.LavalinkForceReconnectCommandExecutor | ||
import hub.nebula.pangea.command.vanilla.dev.UnregisterAllCommandsCommandExecutor | ||
|
||
class ToolsCommand : PangeaSlashCommandDeclarationWrapper { | ||
override fun create() = command("tools", "bot dev tools", isPrivate = true) { | ||
subCommandGroup("lavalink", "lavalink related", this@command.name) { | ||
subCommand("force-reconnect", "reconnect lavalink's node", isPrivate = true) { | ||
executor = LavalinkForceReconnectCommandExecutor() | ||
} | ||
} | ||
|
||
subCommandGroup("commands", "commands related", this@command.name) { | ||
subCommand("unregister", "unregister all commands", isPrivate = true) { | ||
executor = UnregisterAllCommandsCommandExecutor() | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters