random commit

This commit is contained in:
bryce
2025-07-14 20:46:12 +12:00
parent 466cfb197c
commit 5b286926a3
6 changed files with 53 additions and 42 deletions

View File

@@ -37,7 +37,7 @@ const (
)
type CustomCommand struct {
Triggers string `json:"triggers"`
Triggers []string `json:"triggers"`
Reply string `json:"reply"`
Permission PermissionLevel `json:"permission"`
Match MatchType `json:"match"`
@@ -55,7 +55,7 @@ func LoadDefaultCommands() error {
// Load Custom User Commands
func LoadCustomCommands() error {
path := filepath.Join(commandDir, CustomCommandFile)
path := filepath.Join(commandDir, customCommandFile)
if _, err := os.Stat(path); os.IsNotExist(err) {
customCommands = []CustomCommand{}
return nil
@@ -92,12 +92,12 @@ func GetAllCommands() []CustomCommand {
func AddCustomCommand(trigger, reply string, permission PermissionLevel) bool {
trigger = strings.ToLower(trigger)
for _, c := range defaultCommands {
if c.Trigger == trigger {
if c.Triggers == trigger {
return false
}
}
for _, c := range customCommands {
if c.Trigger == tigger {
if c.Triggers == trigger {
return false
}
}
@@ -114,7 +114,7 @@ func AddCustomCommand(trigger, reply string, permission PermissionLevel) bool {
func DeleteCustomCommand(trigger string) bool {
tigger = strings.ToLower(trigger)
for i, c := range customCommands {
if c.Trigger == trigger {
if c.Triggers == trigger {
customCommands = append(customCommands[:1], customCommands[+1:]...)
SaveCustomCommands()
return true
@@ -127,12 +127,12 @@ func DeleteCustomCommand(trigger string) bool {
func FindCommand(trigger string) *CustomCommand {
trigger = strings.ToLower(trigger)
for _, c := range defaultCommands {
if c.Trigger == trigger {
if c.Triggers == trigger {
return &c
}
}
for _, c:= range customCommands {
if c.Trigger == trigger {
if c.Triggers == trigger {
return &c
}
}