-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Unknown Member in Channel#history
#117
Comments
Thank you for your detailed code but I am unable to reproduce this issue on either 3.4.0, the commit you listed or current main. Could you check whether you get the same behaviour with a second channel with under 100 messages? My suspicion is that the issue is caused by another property of the channel you tested with, such as it including messages sent by an account which has left or been deleted. |
Sorry, no - I since moved on and at this time, not making use of the library. |
I seem to be getting this issue on messages where the user is no longer on the server, thing is it does this for each message, and does not seem to be caching the user, and keeps requesting them. This can quickky compound when a bot is attempting to read a lot of history at once, as it's possible each chunk of 100 messages can take up to 30s to complete, causing horrendous slowdown. Thing is, every message then has the info for the user, so it's still retrieving it, just refusing to either save the info, or load it from cache. I've attempted to use #ensure_user to manually cache it in case, but I either don't understand it, or it's also not working properly. |
This is likely due to overeager attempts to resolve the full member object which a message does not provide. The solution is to populate this information lazily on our end |
I have a fix for this but need to clean it up and post a PR. The relevant code is as expected in |
Description
When calling
Channel#history
with a limit larger than the amount of messages that exist in the channel, it would seem like the method is attempting to get author details fornil
messages, and the result is this error appearing multiple times:Reproduction
Run the below code on a channel that has less than 100 messages.
Environment
Ruby version:
Discordrb version:
The text was updated successfully, but these errors were encountered: