Closed RickvanLoo closed 8 years ago
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
This is a pretty good idea: https://github.com/bwmarrin/discordgo/issues/137 Could also solve this: https://github.com/Rivalo/discord-cli/issues/11
Everything is green now, please fix.