mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-11 11:42:00 -08:00
Reconnect on expired session (rocketchat)
This commit is contained in:
parent
8d08e348a9
commit
44f43bc4dd
@ -169,6 +169,15 @@ func (b *Brocketchat) Send(msg config.Message) (string, error) {
|
||||
|
||||
rmsg, err := b.c.SendMessage(smsg)
|
||||
if rmsg == nil {
|
||||
if strings.Contains(err.Error(), "Invalid or expired session, please login again") ||
|
||||
strings.Contains(err.Error(), "error-invalid-user") {
|
||||
b.Log.Info("Login expired, reconnecting..")
|
||||
err = b.apiLogin()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
b.Remote <- config.Message{Username: "system", Text: "rejoin", Channel: "", Account: b.Account, Event: config.EventRejoinChannels}
|
||||
}
|
||||
return "", err
|
||||
}
|
||||
return rmsg.ID, err
|
||||
|
Loading…
Reference in New Issue
Block a user