Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Better User Colouring #3

Closed
RickvanLoo opened this issue Feb 14, 2016 · 2 comments
Closed

Better User Colouring #3

RickvanLoo opened this issue Feb 14, 2016 · 2 comments
Assignees
Milestone

Comments

@RickvanLoo
Copy link
Owner

Everything is green now, please fix.

@RickvanLoo RickvanLoo self-assigned this Feb 14, 2016
@RickvanLoo RickvanLoo added this to the v0.2.1 milestone Feb 14, 2016
@RickvanLoo RickvanLoo modified the milestones: v0.3, v0.2.1 Feb 27, 2016
@RickvanLoo
Copy link
Owner Author

This needs some thinking.

The most straightforward way to retrieve the color ID is currently:

            Member, _ := s.GuildMember(State.Guild.ID, m.Author.ID)

            if len(Member.Roles) != 0 {
                Roles, _ := s.GuildRoles(State.Guild.ID)
                for _, Role := range Roles {
                    if Role.ID == Member.Roles[0] {
                        ColorInt = Role.Color
                    }
                }
            }

Given that we are limited by ANSI colors we also need to incorporate a switch to get the closest ANSI color to the given decimal color representations. Which will completely break if Discord decided to add a color picker in it's client, so it has to have some nasty if/elseif/else statements to check for color ranges.

But the biggest problem is the for loop for every received message. That is just too much. It also means that the program will slowdown if a guild would have many roles.

I assume the official react client does some state magic to get the colors of the users. But for now this issue gets postponed

@RickvanLoo
Copy link
Owner Author

This is a pretty good idea: bwmarrin/discordgo#137
Could also solve this: #11

@RickvanLoo RickvanLoo modified the milestones: v0.3.1, v0.3.0 Mar 1, 2016
ShadowJonathan added a commit to ShadowJonathan/discord-cli that referenced this issue Dec 30, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant