Refactor: Use any instead of interface{}

This commit is contained in:
mhsanaei
2025-03-12 20:43:43 +01:00
parent 280a22b57d
commit 0bde51b91e
19 changed files with 267 additions and 280 deletions
+4 -12
View File
@@ -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) {