Log startup errors and only try to start users who have a token
This commit is contained in:
@@ -38,7 +38,7 @@ func (uq *UserQuery) GetByID(id string) *User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (uq *UserQuery) GetAll() []*User {
|
func (uq *UserQuery) GetAll() []*User {
|
||||||
rows, err := uq.db.Query(`SELECT mxid, id, management_room, token FROM "user"`)
|
rows, err := uq.db.Query(`SELECT mxid, id, management_room, token FROM "user" WHERE token IS NOT NULL`)
|
||||||
if err != nil || rows == nil {
|
if err != nil || rows == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
9
user.go
9
user.go
@@ -182,8 +182,13 @@ func (br *DiscordBridge) getAllUsers() []*User {
|
|||||||
func (br *DiscordBridge) startUsers() {
|
func (br *DiscordBridge) startUsers() {
|
||||||
br.Log.Debugln("Starting users")
|
br.Log.Debugln("Starting users")
|
||||||
|
|
||||||
for _, user := range br.getAllUsers() {
|
for _, u := range br.getAllUsers() {
|
||||||
go user.Connect()
|
go func(user *User) {
|
||||||
|
err := user.Connect()
|
||||||
|
if err != nil {
|
||||||
|
user.log.Errorfln("Error connecting: %v", err)
|
||||||
|
}
|
||||||
|
}(u)
|
||||||
}
|
}
|
||||||
|
|
||||||
br.Log.Debugln("Starting custom puppets")
|
br.Log.Debugln("Starting custom puppets")
|
||||||
|
|||||||
Reference in New Issue
Block a user