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>
This commit is contained in:
Georg Pfuetzenreuter 2024-09-21 17:49:39 +02:00
parent 22b23c755e
commit 1f41d9ac17
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -46,13 +46,7 @@ func (w *WatBot) HandleIrcMsg(c *irc.Client, m *irc.Message) {
} }
func (w *WatBot) Admin(m *irc.Message) bool { func (w *WatBot) Admin(m *irc.Message) bool {
admins := w.c.AdminHosts return w.Allowed(m.Prefix.Host, w.c.AdminHosts)
for _, admin := range admins {
if m.Prefix.Host == admin {
return true
}
}
return false
} }
func (w *WatBot) Allowed(c string, r []string) bool { func (w *WatBot) Allowed(c string, r []string) bool {