ayn2op / discordo

A lightweight, secure, and feature-rich Discord terminal client.
MIT License
2.06k stars 64 forks source link

Added unread indicators #304

Closed StandingPadAnimations closed 5 months ago

StandingPadAnimations commented 1 year ago

2 PRs in the span of 2 days, holy smokes.

Anyway, yes, this PR adds unread indicators. This is done by iterating over the ReadStates in the ReadyEventExtras field of discordState.Ready(). We do check if the channel IDs match, and if so whether the last message IDs match. If they do, then we simply ignore it. Otherwise, we set a tag. This tag is then combined with the channel names, so unread channels will be italicized and bolded.

There are still issues though:

Example of unread channels side-by-side read ones: image

StandingPadAnimations commented 1 year ago

And yes this branch is based off of #302

ghost commented 1 year ago

Why not make the tag configurable? Add guild_unread_color and guild_read_color in internal/config/theme.go under the GuildsTreeTheme structure. Then make the default for read as ::d and for unread as ::bi.

StandingPadAnimations commented 1 year ago

Why not make the tag configurable? Add guild_unread_color and guild_read_color in internal/config/theme.go under the GuildsTreeTheme structure. Then make the default for read as ::d and for unread as ::bi.

Implemented in 2655fc5

StandingPadAnimations commented 1 year ago

Alright I've now added guild indicators, in addition to indicators for pings.

Should we make guild indicators togglable? They make guilds take additional time to load (since there's 5 for loops at max, due to some crazy aspects of ReadyEventExtras

StandingPadAnimations commented 1 year ago

Ok, now channels will be marked as read when you open them. Of course, I still need to get this working only on unread channels (and then get the channels to be updated in the UI).

StandingPadAnimations commented 1 year ago

Ack is now called only for unread channels (that aren't muted). This is done by checking the beginning tag and seeing if it matches the Unread or Mention indicator.