summaryrefslogtreecommitdiffstats
path: root/wat
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2024-09-21 17:49:39 +0200
committerGeorg Pfuetzenreuter2024-09-28 19:33:18 +0200
commitcc322e87e62fa19dabfbddd937da477feb9f2516 (patch)
treeb3854f2abd5b6c7d63bc25d96b2625c8481b01ae /wat
parentbde9a8defb73399e5174794d7bb20907f8716832 (diff)
downloadwatbot-cc322e87e62fa19dabfbddd937da477feb9f2516.tar.gz
watbot-cc322e87e62fa19dabfbddd937da477feb9f2516.tar.bz2
watbot-cc322e87e62fa19dabfbddd937da477feb9f2516.zip
Replace redundant logic in Admin()
The Allowed() function already implements this loop, use it to reduce redundant code. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'wat')
-rw-r--r--wat/bot.go8
1 files changed, 1 insertions, 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 {