From 54cf2521e512f7283be77263186bd85ff9aabdf5 Mon Sep 17 00:00:00 2001 From: rxdn <29165304+rxdn@users.noreply.github.com> Date: Fri, 26 Nov 2021 16:03:45 +0000 Subject: [PATCH] Display badge --- chatreplica/convert.go | 7 ++++++- chatreplica/structs.go | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/chatreplica/convert.go b/chatreplica/convert.go index e87901f..be08539 100644 --- a/chatreplica/convert.go +++ b/chatreplica/convert.go @@ -29,11 +29,16 @@ func FromArchiveMessages(messages []message.Message, ticketId int) Payload { // Add user to entities map snowflake := strconv.FormatUint(msg.Author.Id, 10) if _, ok := users[snowflake]; !ok { + var badge *Badge + if msg.Author.Bot { + badge = badgePtr(BadgeBot) + } + users[snowflake] = User{ Avatar: msg.Author.AvatarUrl(256), Username: msg.Author.Username, Discriminator: msg.Author.Discriminator, - Badge: nil, + Badge: badge, } } } diff --git a/chatreplica/structs.go b/chatreplica/structs.go index 85c5320..8e18a17 100644 --- a/chatreplica/structs.go +++ b/chatreplica/structs.go @@ -53,3 +53,7 @@ type Badge string const ( BadgeBot Badge = "bot" ) + +func badgePtr(b Badge) *Badge { + return &b +}