fix(ui): check if selected channel's ID is same as received message's channel's ID (#120)
This commit is contained in:
parent
42818c4d1d
commit
52490d15b6
1 changed files with 6 additions and 8 deletions
14
ui/app.go
14
ui/app.go
|
|
@ -89,14 +89,12 @@ func (app *App) onGuildCreate(_ *discordgo.Session, g *discordgo.GuildCreate) {
|
|||
}
|
||||
|
||||
func (app *App) onSessionMessageCreate(_ *discordgo.Session, m *discordgo.MessageCreate) {
|
||||
if app.SelectedChannel == nil {
|
||||
return
|
||||
}
|
||||
if app.SelectedChannel != nil && app.SelectedChannel.ID == m.ChannelID {
|
||||
app.SelectedChannel.Messages = append(app.SelectedChannel.Messages, m.Message)
|
||||
app.MessagesTextView.Write(buildMessage(app, m.Message))
|
||||
|
||||
app.SelectedChannel.Messages = append(app.SelectedChannel.Messages, m.Message)
|
||||
app.MessagesTextView.Write(buildMessage(app, m.Message))
|
||||
|
||||
if len(app.MessagesTextView.GetHighlights()) == 0 {
|
||||
app.MessagesTextView.ScrollToEnd()
|
||||
if len(app.MessagesTextView.GetHighlights()) == 0 {
|
||||
app.MessagesTextView.ScrollToEnd()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue