Make sure we use the configured format string on room name updates
Refs #37
This commit is contained in:
@@ -413,10 +413,22 @@ func (p *Portal) handleDiscordMessageCreate(user *User, msg *discordgo.Message)
|
|||||||
|
|
||||||
// Handle room name changes
|
// Handle room name changes
|
||||||
if msg.Type == discordgo.MessageTypeChannelNameChange {
|
if msg.Type == discordgo.MessageTypeChannelNameChange {
|
||||||
p.Name = msg.Content
|
channel, err := user.Session.Channel(msg.ChannelID)
|
||||||
|
if err != nil {
|
||||||
|
p.log.Errorf("Failed to find the channel for portal %s", p.Key)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
name, err := p.bridge.Config.Bridge.FormatChannelname(channel, user.Session)
|
||||||
|
if err != nil {
|
||||||
|
p.log.Errorf("Failed to format name for portal %s", p.Key)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
p.Name = name
|
||||||
p.Update()
|
p.Update()
|
||||||
|
|
||||||
p.MainIntent().SetRoomName(p.MXID, msg.Content)
|
p.MainIntent().SetRoomName(p.MXID, name)
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user