revise command rework

This commit is contained in:
wish
2022-09-30 02:54:37 +10:00
parent 2f123d96df
commit 9b1f3f8012
3 changed files with 53 additions and 99 deletions

View File

@@ -19,7 +19,7 @@ type Config struct {
DevModeOptions DevModeOptions
Discord Discord
ServerCommands ServerCommands
Commands []Command
Database Database
Launcher Launcher
Sign Sign
@@ -64,13 +64,8 @@ type Discord struct {
DevMode bool
}
// Server commands
type ServerCommands struct {
Enabled bool
Commands []ServerCommand
}
type ServerCommand struct {
// Command is a channelserver chat command
type Command struct {
Name string
Enabled bool
Prefix string
@@ -142,17 +137,6 @@ func init() {
}
func GetServerCommandByName(cmdName string) ServerCommand {
var val ServerCommand
for _, c := range ErupeConfig.ServerCommands.Commands {
if c.Name == cmdName {
return c
}
}
return val
}
// getOutboundIP4 gets the preferred outbound ip4 of this machine
// From https://stackoverflow.com/a/37382208
func getOutboundIP4() net.IP {