Discord Discord roles not syncing?

I want to give anyone who connects their account a Discord role. I added a new role in Discord, synced, and then connected it to Registered under Discord associated groups. Then I synced again, but the new role was not given to users who connected their accounts.

Does "Overwrite Discord roles upon successful sync" have to be enabled for this to work? I left this disabled because I don't want other roles to be removed.
 
I'm not sure what you mean by you "synced". Could you describe what you're doing there?

In addition, have you followed the guide here? Notably, is the bot in a role that is higher in the hierarchy than your other roles?
 
I'm not sure what you mean by you "synced". Could you describe what you're doing there?

In addition, have you followed the guide here? Notably, is the bot in a role that is higher in the hierarchy than your other roles?
By sync, I mean clicking this button:
1686708015898.png
Is it necessary to click this?

And yes, I have followed the installation guide. The DMed notifications are working. The installation guide doesn't mention the bot's role being higher than the other roles, but after it didn't work at first, I did move it up and then also made sure the group had permission to manage roles.

Does "Overwrite Discord roles upon successful sync" need to be enabled in the options? If so, will this remove Discord roles that aren't associated with any XF user groups?
 
Is it necessary to click this?
No, it's not necessary to click that. I'll make it clearer in the next version but that button only syncs some behind-the-scenes information about the server.
The installation guide doesn't mention the bot's role being higher than the other roles, but after it didn't work at first, I did move it up and then also made sure the group had permission to manage roles.
Does the bot's role have admin permissions also?
Does "Overwrite Discord roles upon successful sync" need to be enabled in the options? If so, will this remove Discord roles that aren't associated with any XF user groups?
That option does not need to be enabled but yes, it does remove roles not associated with XF groups.
 
Does the bot's role have admin permissions also?
Yes, these are the permissions that are currently enabled for the bot's role:
  • View Channels
  • Manage Roles
  • Manage Nicknames
  • Administrator
Are there any others that should be enabled?

No, it's not necessary to click that. I'll make it clearer in the next version but that button only syncs some behind-the-scenes information about the server.
I see. How long does it take to see changes made / accounts connected? (Or is instant?)

I currently have only one associated group in the add-on's settings, which is for the Registered group. I have one Discord role checked under this associated group. My intention is to make it so any member of the forum who connects their account to Discord will be put in this Discord role. However, there are currently 10 users other than myself who have connected their forum account to Discord, but 0 people in the Discord role.
 
I wonder if the issue is caused by this error I received. When adding a Discord role to a forum user group for the first time, clicking Save gave this error:

ErrorException: [E_WARNING] Undefined array key "position" in src/addons/NF/Discord/Job/GroupSync.php at line 49
  1. XF::handlePhpError() in src/addons/NF/Discord/Job/GroupSync.php at line 49
  2. NF\Discord\Job\GroupSync->getStatusMessage() in src/XF/Admin/Controller/Tools.php at line 176
  3. XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 352
  4. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
  5. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
  6. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
  7. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2351
  8. XF\App->run() in src/XF.php at line 517
  9. XF::runApp() in admin.php at line 13

When I look at the user group again, the role is still checked, but it doesn't seem to do anything.
 
Any other ideas to get this working?
Sorry, I've been away for a few days and just catching up with things now.
I wonder if the issue is caused by this error I received. When adding a Discord role to a forum user group for the first time, clicking Save gave this error:



When I look at the user group again, the role is still checked, but it doesn't seem to do anything.
This is a bug, reported and fixed here.
I see. How long does it take to see changes made / accounts connected? (Or is instant?)
It's instant (when everything is setup correctly).

I currently have only one associated group in the add-on's settings, which is for the Registered group. I have one Discord role checked under this associated group. My intention is to make it so any member of the forum who connects their account to Discord will be put in this Discord role. However, there are currently 10 users other than myself who have connected their forum account to Discord, but 0 people in the Discord role.
Just to check, those other 10 users aren't admins or otherwise outranking the bot in role permissions are they?

Finally, does the Admin -> Tools -> Test Discord integration pass?
 
Sorry, I've been away for a few days and just catching up with things now.

This is a bug, reported and fixed here.

It's instant (when everything is setup correctly).


Just to check, those other 10 users aren't admins or otherwise outranking the bot in role permissions are they?

Finally, does the Admin -> Tools -> Test Discord integration pass?
Thanks for the reply, and I'll check out the update for that error.

As for the role issue, I put the bot's role above all others except admins in Discord's role list.

This query now shows me 15 non-admin users:
SELECT *
FROM xf_user_connected_account
WHERE provider = 'nfDiscord'

The interesting thing is that there is now one user in the role. Still not 15, but it partially worked?

As for Test Discord, here are the results:
1687114409551.png
 
I noticed on the front page of the ACP, the message that says "There are manual rebuild jobs awaiting completion. Continue running them."

I clicked it and it was the same error that I pasted above. Could this error be the cause after all or is it actually unrelated?
 
I noticed on the front page of the ACP, the message that says "There are manual rebuild jobs awaiting completion. Continue running them."

I clicked it and it was the same error that I pasted above. Could this error be the cause after all or is it actually unrelated?
Oh yeah, good point. Just released the fix for that if you wouldn't mind upgrading and then reporting back. Thanks!
 
It may be working now. It showed two users (instead of the previous one) at first. Then I unchecked the role association and checked it again. Then it took a minute, but there are a total of seven in the role now. Maybe it will add the other 8 eventually? (Maybe they have to login to the forum again?)
 
Last edited:
Sync tasks get put in to a queue and are processed in the background so you might have caught it midway through. Is it working now?
 
Yes, it's working now, that update fixed it. It seems the reason only half appeared to be working on Monday is because some of them were newly registered accounts who must have used the Discord feature to register, but weren't actually members of the server. Thanks!
 
Back
Top