From cc322e87e62fa19dabfbddd937da477feb9f2516 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sat, 21 Sep 2024 17:49:39 +0200 Subject: Replace redundant logic in Admin() The Allowed() function already implements this loop, use it to reduce redundant code. Signed-off-by: Georg Pfuetzenreuter --- wat/bot.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/wat/bot.go b/wat/bot.go index dae4e89..2e889b7 100644 --- a/wat/bot.go +++ b/wat/bot.go @@ -46,13 +46,7 @@ func (w *WatBot) HandleIrcMsg(c *irc.Client, m *irc.Message) { } func (w *WatBot) Admin(m *irc.Message) bool { - admins := w.c.AdminHosts - for _, admin := range admins { - if m.Prefix.Host == admin { - return true - } - } - return false + return w.Allowed(m.Prefix.Host, w.c.AdminHosts) } func (w *WatBot) Allowed(c string, r []string) bool { -- cgit v1.2.3