* Nicknames will be used instead of usernames now if possible. (Not reliable due to slow user loading)
MODIFY
internal/ui/chatview.go
internal/ui/chatview.go
@@ -217,7 +217,21 @@ func (chatView *ChatView) AddMessages(messages []*discordgo.Message) {
}
}
- messageText = fmt.Sprintf("[\"%s\"][#FF0000]%s[#00FF00]%s [white]%s[\"\"]", message.ID, timeCellText, message.Author.Username, messageText)
+ var messageAuthor string
+ if message.GuildID != "" {
+ member, cacheError := chatView.session.State.Member(message.GuildID, message.Author.ID)
+ if cacheError == nil && member.Nick != "" {
+ messageAuthor = member.Nick
+ }
+ } else {
+ fmt.Println(message.GuildID)
+ }
+
+ if messageAuthor == "" {
+ messageAuthor = message.Author.Username
+ }
+
+ messageText = fmt.Sprintf("[\"%s\"][#FF0000]%s[#00FF00]%s [white]%s[\"\"]", message.ID, timeCellText, messageAuthor, messageText)
newText = fmt.Sprintf("%s\n%s", newText, messageText)
if mentionsUser {

MODIFY
internal/ui/window.go
internal/ui/window.go
@@ -883,6 +883,11 @@ func (window *Window) LoadChannel(channel *discordgo.Channel) error {
var discordError error
messages, discordError = window.session.ChannelMessages(channel.ID, 100, "", "", "")
if discordError == nil {
+ if channel.GuildID != "" {
+ for _, message := range messages {
+ message.GuildID = channel.GuildID
+ }
+ }
cache.Messages = append(cache.Messages, messages...)
}
} else {

* Nicknames will be used instead of usernames now if possible. (Not reliable due to slow user loading)