Closed ImRodry closed 3 years ago
I'm having hard time understanding from where did you get a "not properly cached" GuildMember
object, considering you claim you don't have any partials or intents enabled. Could you elaborate on that?
I'm having hard time understanding from where did you get a "not properly cached"
GuildMember
object, considering you claim you don't have any partials or intents enabled. Could you elaborate on that?
Well what I’m referring to is one of those users whose name doesn’t show up when you tag them and instead it just shows <@!id> (and yes the member was on the server I tested this on). The member object was obtained through guild.members.cache.get(id). Hope this helps. To make it easier to get one of these, try getting a list of all the members in a guild with a certain role, one of those will most likely not be cached.
all members in guild.members.cache
are cached (as the code suggests); if they weren't cached then guild.members.cache.get(id)
would just return undefined
Well then I’m not sure what the issue is. The truth is that the exact same code didn’t work when the user’s name wasn’t showing on the mention and then it did when the user finally loaded. Could’ve been coincidental but I believe the behavior described should still be considered a bug
well I checked the code and it seems impossible that this was caused by discord.js so it's probably caused by your code or a different library you're using
also, your client's cache has nothing to do with your bot's cache
I also checked the code before submitting and it did seem unlikely but the truth is that it’s gotta be discord.js causing this. All my code is in that code example I had absolutely nothing else running before.
And yes I know client and bot cache are different and that’s why I said that could’ve been a coincidence. It was just an easier way of explaining how to obtain this result. Have you tried the steps I suggested?
It's possible that the role color of the unresolved mention is returning blurple, in which case, Discord.js can't do anything about it because it's an issue with client-side caching.
Just finished testing what you said; With 2 bot setup i picked few random IDs that were fetched on one bot but not on the other, and then manually mentioned uncached members. Bot cached 2 out of 3 mentioned members through mentions themselves, but still reported correct color for them.
On the other hand, i am unable to not fetch members with "actual" roles that have colors, no matter their status, so only thing i could test was if the color was 0
in both cases (fetched "normally" and through mention)
Discord.js does have that specific color code in the codebase (it's BLURPLE
afterall), but it does not use it anywhere on its own.
It's possible that the role color of the unresolved mention is returning blurple, in which case, Discord.js can't do anything about it because it's an issue with client-side caching.
But even then it shouldn’t return a hex value with displayColor and a value with ## with displayHexColor.
Just finished testing what you said; With 2 bot setup i picked few random IDs that were fetched on one bot but not on the other, and then manually mentioned uncached members. Bot cached 2 out of 3 mentioned members through mentions themselves, but still reported correct color for them.
On the other hand, i am unable to not fetch members with "actual" roles that have colors, no matter their status, so only thing i could test was if the color was
0
in both cases (fetched "normally" and through mention)Discord.js does have that specific color code in the codebase (it's
BLURPLE
afterall), but it does not use it anywhere on its own.
Were the users you tested displaying like I described (id instead of displayname)? If so did you try fetching all members of the guild so you could get that member object? Like I said in the issue, fetching the user individually doesn’t always fix the issue so you could still come across it. If you want I can also send screenshots of the bug happening to me.
(id instead of displayname) If so did you try fetching all members of the guild so you could get that member object?
Again; What you see in your desktop client has absolutely nothing to do with what your bot has cached or not. Those are completely 2 irrelevant from each other things.
If you want I can also send screenshots of the bug happening to me.
Sure, since no one i spoke to seems to have any clue what would cause that
Again; What you see in your desktop client has absolutely nothing to do with what your bot has cached or not. Those are completely 2 irrelevant from each other things.
Again, I know that but so far every member that displayed like that had this bug happen to them
Here’s an example (I grabbed a list of members, picked one that wasn’t displaying correctly and used eval to see their displayColor and displayHexColor
'##7289da'
should never ever happen. There is no reason why executing this code twice would result in a different outcome (added # symbol). This alone points to something going majorly wrong here. Seeing that no one (including me) can reproduce that in any way, shape, or form my guess would be that you either do something in another piece of code that executes (for example assignment instead of comparison *) or use a modified version of the library.
* Edit: looking into it again:
If you somehow manage to overwrite <Role>.color
with "#7289da"
- for example if (role.color = "#7289da")
that'd explain both described behaviors, which I assume is happening somewhere in your code.
That command literally only evaluates whatever piece of code I give it with absolutely zero modifications to it. I already said previously that this behavior is inconsistent and therefore "running this code twice" doesn't always fix it (like I mentioned in the issue). If you wanna take a look at my code, here's the command I was running: https://github.com/Hypixel-Translators/hypixel-translators-bot/blob/master/commands/Admin/eval.js and here's the line where the client is defined: https://github.com/Hypixel-Translators/hypixel-translators-bot/blob/master/index.js#L3 I'm not modifying the role color anywhere in my code. The only place where that hex value appears is on my config to define the blurple variable which is not used anywhere else in this case. This is clearly a bug with your library and I don't understand why you're trying to blame it on me after all the proof I've given you.
"I'm not modifying the role color anywhere" mhm, sure.
"I'm not modifying the role color anywhere" mhm, sure.
Are you kidding me? That's a completely different file from the one I sent. My bot only runs the file corresponding to the command I run so in this case it only ran the function in "eval.js" and not "members.js" which is where you got that from. Also that would still not explain the behaviour because "blurple" is #7289da and NOT ##7289da. Is that enough already?
the file doesn't matter; you're modifying the cached role object, which is accessed when you get the member from cache as you are doing in the eval
the file doesn't matter; you're modifying the cached role object, which is accessed when you get the member from cache as you are doing in the eval
Okay you're right, thanks for actually explaining it. I didn't think that would influence other commands but seems to do so I changed the behavior so now it modifies a variable instead of the role object. Thanks for your help once again @advaith1
Please describe the problem you are having in as much detail as possible: When you try to access a member's displayColor or displayHexColor when the user is not properly cached it returns weird values
Include a reproducible code sample here, if possible:
Also keep in mind that fetching the member doesn't always work
Further details:
Relevant client options: