From 579921a97529d22100cc6dd9a7a5488a12ebf5c8 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Mon, 5 Sep 2022 12:54:56 -0500 Subject: [PATCH] s/HasCommand/ContainsCommand/g --- bot/handler/coin.go | 2 +- bot/handler/deal.go | 2 +- bot/handler/dice.go | 2 +- bot/handler/ping.go | 2 +- bot/handler/version.go | 2 +- lib/common.go | 2 +- lib/common_test.go | 6 +++--- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bot/handler/coin.go b/bot/handler/coin.go index 5ed45dc..d5557b3 100644 --- a/bot/handler/coin.go +++ b/bot/handler/coin.go @@ -38,7 +38,7 @@ func (h *CoinHandler) Handle(s *discordgo.Session, m *discordgo.MessageCreate) { return } - if !lib.HasCommand(m.Content, h.config.Prefix, h.Name) { + if !lib.ContainsCommand(m.Content, h.config.Prefix, h.Name) { return } diff --git a/bot/handler/deal.go b/bot/handler/deal.go index 6ae95db..4bef4eb 100644 --- a/bot/handler/deal.go +++ b/bot/handler/deal.go @@ -67,7 +67,7 @@ func (h *DealHandler) Handle(s *discordgo.Session, m *discordgo.MessageCreate) { return } - if !lib.HasCommand(m.Content, h.config.Prefix, h.Name) { + if !lib.ContainsCommand(m.Content, h.config.Prefix, h.Name) { return } diff --git a/bot/handler/dice.go b/bot/handler/dice.go index cfe7ee6..a10aaf2 100644 --- a/bot/handler/dice.go +++ b/bot/handler/dice.go @@ -103,7 +103,7 @@ func (h *RollHandler) Handle(s *discordgo.Session, m *discordgo.MessageCreate) { return } - if !lib.HasCommand(m.Content, h.config.Prefix, h.Name) { + if !lib.ContainsCommand(m.Content, h.config.Prefix, h.Name) { return } diff --git a/bot/handler/ping.go b/bot/handler/ping.go index 106d3fc..84ff829 100644 --- a/bot/handler/ping.go +++ b/bot/handler/ping.go @@ -27,7 +27,7 @@ func (h *PingHandler) Handle(s *discordgo.Session, m *discordgo.MessageCreate) { return } - if !lib.HasCommand(m.Content, h.config.Prefix, h.Name) { + if !lib.ContainsCommand(m.Content, h.config.Prefix, h.Name) { return } diff --git a/bot/handler/version.go b/bot/handler/version.go index 72b1f06..4f07727 100644 --- a/bot/handler/version.go +++ b/bot/handler/version.go @@ -33,7 +33,7 @@ func (h *VersionHandler) Handle(s *discordgo.Session, m *discordgo.MessageCreate return } - if !lib.HasCommand(m.Content, h.config.Prefix, h.Name) { + if !lib.ContainsCommand(m.Content, h.config.Prefix, h.Name) { return } diff --git a/lib/common.go b/lib/common.go index eddda01..bf9b562 100644 --- a/lib/common.go +++ b/lib/common.go @@ -50,7 +50,7 @@ func BuildURI(rawuri, rawpath string) string { return u.String() } -func HasCommand(s, prefix, cmd string) bool { +func ContainsCommand(s, prefix, cmd string) bool { s = strings.TrimSpace(s) args := strings.Split(s, " ") diff --git a/lib/common_test.go b/lib/common_test.go index 43371aa..023e195 100644 --- a/lib/common_test.go +++ b/lib/common_test.go @@ -2,7 +2,7 @@ package lib import "testing" -func TestHasCommand(t *testing.T) { +func TestContainsCommand(t *testing.T) { tables := []struct { s string prefix string @@ -18,9 +18,9 @@ func TestHasCommand(t *testing.T) { } for _, table := range tables { - r := HasCommand(table.s, table.prefix, table.cmd) + r := ContainsCommand(table.s, table.prefix, table.cmd) if r != table.r { - t.Errorf("HasCommand(%q, %q, %q), got: %t, want: %t", + t.Errorf("ContainsCommand(%q, %q, %q), got: %t, want: %t", table.s, table.prefix, table.cmd, r, table.r, ) }