(token string)
| 66 | } |
| 67 | |
| 68 | func (w *BotWorkers) Add(token string) (err error) { |
| 69 | w.incStarting() |
| 70 | var botID int = w.starting |
| 71 | client, err := startWorker(w.log, token, botID) |
| 72 | if err != nil { |
| 73 | return err |
| 74 | } |
| 75 | w.log.Sugar().Infof("Bot @%s loaded with ID %d", client.Self.Username, botID) |
| 76 | w.Bots = append(w.Bots, &Worker{ |
| 77 | Client: client, |
| 78 | ID: botID, |
| 79 | Self: client.Self, |
| 80 | log: w.log, |
| 81 | }) |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | func GetNextWorker() *Worker { |
| 86 | Workers.mut.Lock() |
no test coverage detected