From 4b54589178896de9eda408e0d92afd7fb173cab2 Mon Sep 17 00:00:00 2001 From: "Gustavo L de Mello (Guz)" Date: Fri, 22 Nov 2024 19:10:58 -0300 Subject: [PATCH] fix(lib,commands): update Validate() method --- lib/command_message.go | 10 +++++----- lib/command_user.go | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/command_message.go b/lib/command_message.go index d6efed8..a17748d 100644 --- a/lib/command_message.go +++ b/lib/command_message.go @@ -28,16 +28,16 @@ func (c *MessageCommand) ApplicationCommand() *discordgo.ApplicationCommand { } } -func (c *MessageCommand) Validate() (bool, error) { +func (c *MessageCommand) Validate() error { switch { case c.Name == "": - return false, errors.New("Required property \"Name\" is empty") + return errors.New("Required property \"Name\" is empty") case c.Description == "": - return false, errors.New("Required property \"Description\" is empty") + return errors.New("Required property \"Description\" is empty") case c.Handler == nil: - return false, errors.New("Required property \"Handler\" is empty") + return errors.New("Required property \"Handler\" is empty") } - return true, nil + return nil } type MessageCommandCtx struct { diff --git a/lib/command_user.go b/lib/command_user.go index 4b77f4f..52e638c 100644 --- a/lib/command_user.go +++ b/lib/command_user.go @@ -28,16 +28,16 @@ func (c *UserCommand) ApplicationCommand() *discordgo.ApplicationCommand { } } -func (c *UserCommand) Validate() (bool, error) { +func (c *UserCommand) Validate() error { switch { case c.Name == "": - return false, errors.New("Required property \"Name\" is empty") + return errors.New("Required property \"Name\" is empty") case c.Description == "": - return false, errors.New("Required property \"Description\" is empty") + return errors.New("Required property \"Description\" is empty") case c.Handler == nil: - return false, errors.New("Required property \"Handler\" is empty") + return errors.New("Required property \"Handler\" is empty") } - return true, nil + return nil } type UserCommandCtx struct {