Please describe the problem you are having in as much detail as possible:
When attempting to send a message of the URL's of every user in the guild, it only sends about a third and throws this error:
"TypeError: Cannot destructure property reply of 'undefined' or 'null'."
I don't know how that's in relation at all to the code sample below.
Include a reproducible code sample here, if possible:
let b = msg.guild.members.map(x => x);
for (let i in b) {
client.channels.get('channel id').send(b[i].user.avatarURL)
}
Further details:
I used the same code sample on my guild which has 4 members only, and the expected output was achieved. I tested it in discord.[email protected], discord.[email protected], and in the master branch.
If anything is going to happen, you will get rate limited due to the repetitive API call (API spam); as you are sending a message containing the avatar URL for every member.
Are you doing anything rather than that code sample? Like some side functions or events might be triggered without notice containing Message#reply.
I expected being ratelimited, but shouldn't Discord resume the buffer?
Is there a ratelimit on requests for profile pictures?
I haven't modified .reply in anyway, and the code in the sample is all that's being run
Although it might be worth looking into it, you realize that code is crazy api spam right? You would be far better off pushing those to an aray or something and sending a concatenated string which would make far fewer api calls.
I ran code from example and indeed got the error.
However, interestingly enough, when i replaced sending with logging to console, and then ran it in same guild in same minute, error wasn't thrown.
It might be related to the large amount of API calls. I still don't understand the relation with Message#reply, though.
Could you please show the stacktrace of the error and the string being sent?
I can not see how this would happen when sending a string.
It could be possible that a Member does not have a custom avatar since ur using User.avatarURL as opposed to User.displayAvatarURL. Sending undefined gives a "Can't send empty message" error.
Can you confirm if @KinectTheUnknown's comment was valid?
Most helpful comment
It could be possible that a Member does not have a custom avatar since ur using
User.avatarURLas opposed toUser.displayAvatarURL. Sendingundefinedgives a "Can't send empty message" error.