mirror of
https://github.com/cwinfo/matterbridge.git
synced 2024-11-22 12:50:27 +00:00
Join rooms not already joined by the bot (gitter). See #135
This commit is contained in:
parent
deb2d7194d
commit
eddc691fc9
@ -52,11 +52,14 @@ func (b *Bgitter) Disconnect() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Bgitter) JoinChannel(channel string) error {
|
func (b *Bgitter) JoinChannel(channel string) error {
|
||||||
room := channel
|
roomID, err := b.c.GetRoomId(channel)
|
||||||
roomID := b.getRoomID(room)
|
if err != nil {
|
||||||
if roomID == "" {
|
|
||||||
return fmt.Errorf("Could not find roomID for %v. Please create the room on gitter.im", channel)
|
return fmt.Errorf("Could not find roomID for %v. Please create the room on gitter.im", channel)
|
||||||
}
|
}
|
||||||
|
room, err := b.c.GetRoom(roomID)
|
||||||
|
if err != nil {
|
||||||
|
b.Rooms = append(b.Rooms, *room)
|
||||||
|
}
|
||||||
user, err := b.c.GetUser()
|
user, err := b.c.GetUser()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -84,7 +87,7 @@ func (b *Bgitter) JoinChannel(channel string) error {
|
|||||||
flog.Errorf("connection with gitter closed for room %s", room)
|
flog.Errorf("connection with gitter closed for room %s", room)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(stream, room)
|
}(stream, room.Name)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user