diff options
| author | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-03-12 22:13:51 +0300 |
|---|---|---|
| committer | mhsanaei <ho3ein.sanaei@gmail.com> | 2025-03-12 22:43:43 +0300 |
| commit | 0bde51b91ea505e38569ae3cbe575695abd2db60 (patch) | |
| tree | 3d27346586f5802d12cdbb7a1fe95c2b5d46156f /web/service/tgbot.go | |
| parent | 280a22b57d14a372d99bcc49add515721290678b (diff) | |
Refactor: Use any instead of interface{}
Diffstat (limited to 'web/service/tgbot.go')
| -rw-r--r-- | web/service/tgbot.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/web/service/tgbot.go b/web/service/tgbot.go index 1bc504c9..9e217124 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -20,6 +20,8 @@ import ( "x-ui/web/locale" "x-ui/xray" + "slices" + "github.com/mymmrac/telego" th "github.com/mymmrac/telego/telegohandler" tu "github.com/mymmrac/telego/telegoutil" @@ -894,12 +896,7 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool } func checkAdmin(tgId int64) bool { - for _, adminId := range adminIds { - if adminId == tgId { - return true - } - } - return false + return slices.Contains(adminIds, tgId) } func (t *Tgbot) SendAnswer(chatId int64, msg string, isAdmin bool) { @@ -1692,12 +1689,7 @@ func (t *Tgbot) notifyExhausted() { } func int64Contains(slice []int64, item int64) bool { - for _, s := range slice { - if s == item { - return true - } - } - return false + return slices.Contains(slice, item) } func (t *Tgbot) onlineClients(chatId int64, messageID ...int) { |
