mirror of
https://github.com/ergochat/ergo.git
synced 2025-02-16 13:40:48 +01:00
use slices.Contains from go1.21
This commit is contained in:
parent
b3abd0bf1d
commit
28d9a7ff63
@ -6,6 +6,7 @@ package irc
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"slices"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -218,7 +219,7 @@ func csAmodeHandler(service *ircService, server *Server, client *Client, command
|
|||||||
// check for anything valid as a channel mode change that is not valid
|
// check for anything valid as a channel mode change that is not valid
|
||||||
// as an AMODE change
|
// as an AMODE change
|
||||||
for _, modeChange := range modeChanges {
|
for _, modeChange := range modeChanges {
|
||||||
if !utils.SliceContains(modes.ChannelUserModes, modeChange.Mode) {
|
if !slices.Contains(modes.ChannelUserModes, modeChange.Mode) {
|
||||||
invalid = true
|
invalid = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,12 +35,3 @@ func CopyMap[K comparable, V any](input map[K]V) (result map[K]V) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func SliceContains[T comparable](slice []T, elem T) (result bool) {
|
|
||||||
for _, t := range slice {
|
|
||||||
if elem == t {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user