Fixed dangling pings and read states

This commit is contained in:
diamondburned 2020-07-16 23:39:09 -07:00
parent 50ba10bf61
commit 2f4cb5f246
2 changed files with 3 additions and 7 deletions

View File

@ -257,11 +257,7 @@ func (ch *Channel) JoinServer(ctx context.Context, ct cchat.MessagesContainer) (
ch.session.AddHandler(func(m *gateway.MessageCreateEvent) {
if m.ChannelID == ch.id {
ct.CreateMessage(NewMessageCreate(m, ch.session))
// Mark as read if the message is not ours. This handler will
// stay here as long as the client is seeing the channel.
if m.Author.ID != ch.session.userID {
ch.session.ReadState.MarkRead(ch.id, m.ID)
}
ch.session.ReadState.MarkRead(ch.id, m.ID)
}
}),
ch.session.AddHandler(func(m *gateway.MessageUpdateEvent) {

View File

@ -104,9 +104,9 @@ func RenderMemberName(m discord.Member, g discord.Guild) text.Rich {
// Update the color.
if c := discord.MemberColor(g, m); c > 0 {
name.Segments = []text.Segment{
name.Segments = append(name.Segments,
segments.NewColored(len(name.Content), c.Uint32()),
}
)
}
// Append the bot prefix if the user is a bot.