简体   繁体   中英

Discord Adding the role timed out

I am Creating a shop,where users can buy roles. The main issue is that I can't handle multiple of request due to dicord api rate limit and I don't know how to handle it

Code to add user the role:

 guildMember.addRole(role).catch(function(err) {
    if(err.toString() === 'Error: Adding the role timed out.') return res.json({msg:err.toString(),icon: "error"});  
    else {
      return res.json({msg: 'item bought!',icon: "success"});  
    }
  });

The issue is that discord gives me an error (Error: Adding the role timed out.), but even with this error the user can get the role and I don't know why basically I can't handle this problem cause the user can or can't get the role even with this error

It may be related to the use of ram. I have this problem. And whenever I try to save something to JSON the ram gets too high

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM