cant say im not proud of my last discord roles resource. the code was beyond shabby and had many things i just didnt think about. so i tried to fix that.
NOTE: THIS WILL NOT FUNCTION AS A PLUG N PLAY FOR RESOURCES DEPENDING ON discord_roles. THIS IS A COMPLETE REWORK AND WILL REQUIRE THE RESOURCE DEPENDING ON IT TO BE UPDATED OR MODIFIED.
attempt 2
this resource is just an improvement to the old version, however the implementation is a lot different, so i dont expect many people to really adapt it to what already exists sadly.
The standard rule for each export is as follows:
guild is an optional value that will take a custom guild ( a guild different to the one defined in your config.json )
role can be an array/table or a string. if array, it simply checks to see if any of the items match any roles in the users roles.
( note: the first param is the users id, but im using discordid here as an example )
exports['discordroles']:isRolePresent('138725221749358592', {'749808671558729729'} --[[ can be a table or just a string. ]], function(hasRole, roles)
if (not roles) then print("user not in guild") end --roles will be null if no user can be found, suggesting they arent in the guild
print('userHasRole: '..(hasRole and 'true' or 'false'))
print('roles: '..json.encode(roles))
end)
for zap users - see here on a solution for any issues
I love your current implemintation but its got that one bug where if two connect at the same time it can mix up the roles. Does this work with the aceperms and such also? I am going to try it on my dev server and find out tonight.
But I do want to say Thank you for all you do, because it helps!
If anyone will run into Discord rate limit error (429), just know that request limit is 5 requests in about one second, so you need to request at least every 200ms (at least it was for me).
That’s just some information on which I had to do little research and testings, hope it helps someone.
having a 404 would mean that some data is missing, are you sure your guild id is correct, can you show me an example or so? try turn on debug mode in the config and seeing the prints, and send em over if possible.
ohhh, i think it could be related to the user not being in the guild i suspect. axios catches any statuscode outside of 2** so it fell into the error category.
This isn’t possible tho, I am using DisordWhitelist (with your older version)
And its happening for every single user (including myself, and I am defo in the guild ^^ )
Edit:
Forgot to mention that I will try this tomorrow, I’m heading off rn and I’ll keep you updated tomorrow.
Looking good. Was having quite a few issues with v1 as you stated when you closed it that it caused quite a few issues. Hoping to start work on rewritting my server’s permissions systems with this.
If so then yes I am 100% sure,
I have copied id through discord developer mode, I am using the same guild id in the old version, I have copied the id (which is the same) from the webhooks section as well etc
And when the script initializes it says the name of my bot etc so that should work too…