From f475bddacd97b616c436a7dbb307d89299a3f550 Mon Sep 17 00:00:00 2001 From: David Haukeness Date: Tue, 31 Mar 2020 20:29:48 +0000 Subject: [PATCH] added isRoot Command --- utils.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils.go b/utils.go index c4f7771..c593c21 100644 --- a/utils.go +++ b/utils.go @@ -47,3 +47,13 @@ func hasCommandPrefix(s string, baseCommand string, botName string, subCommands } return false } + +// isRootCommand determines if the command is the root command or name with no arguments +func isRootCommand(s string, baseCommand string, botName string) bool { + botCommand := fmt.Sprintf("!%s", baseCommand) + nameCommand := fmt.Sprintf("@%s", botName) + if s == botCommand || s == nameCommand { + return true + } + return false +}