chore: add all bots in stream

This commit is contained in:
divyam234 2024-08-10 08:55:02 +05:30
parent c7be0ead76
commit a64eb57ea4
2 changed files with 4 additions and 1 deletions

View file

@ -28,6 +28,9 @@ func NewBotWorker() *BotWorker {
func (w *BotWorker) Set(bots []string, channelID int64) {
w.mu.Lock()
defer w.mu.Unlock()
if _, ok := w.bots[channelID]; ok {
return
}
w.bots[channelID] = bots
w.currIdx[channelID] = 0
}

View file

@ -750,7 +750,7 @@ func (fs *FileService) GetFileStream(c *gin.Context, download bool) {
multiThreads = 0
} else if fs.cnf.TG.DisableBgBots && len(tokens) > 0 {
fs.botWorker.Set(tokens[0:min(len(tokens), fs.cnf.TG.Stream.BotsLimit)], file.ChannelID)
fs.botWorker.Set(tokens, file.ChannelID)
token, _ = fs.botWorker.Next(file.ChannelID)
client, err = tgc.BotClient(c, fs.kv, &fs.cnf.TG, token)
if err != nil {