Discord Integration

Discord Integration [Paid] 2.8.6

No permission to buy ($35.00)
Ok, so a couple of days later and I think I'm eliminated some of the issues. @Naz informed me that the Xenforo and Discord accounts need to be LINKED for the sync to work. Not sure why I assumed anything else as that makes total sense.

SO; when trying to link my Discord account I get an error after I authorize. "An error occurred while connecting with Discord. Please try again later." message. I check the Xenforo server error log after receiving this message? Nothing. It's empty (which is good!)

The permissions bot seems to pop up fine but I receive that message "An error occurred while connecting with Discord" AFTER clicking AUTHORIZE.


1706532808083.webp

Wondering if maybe the redirect is not working? My Xenforo is hosted at https://www.domainname.com/forums and not the root directory?

I added all the redirects I could think of to cover this off.

1706532792185.webp
 
MAJOR SECURITY ISSUE ALERT

We have connected discord accounts getting switched with different users which posts a massive security risk.

Code:
GuzzleHttp\Exception\ClientException: Discord Msg: 8054; Client error: `PATCH https://discord.com/api/guilds/902369439545180180/members/1176679893304610899` resulted in a `403 Forbidden` response: {"message": "Missing Permissions", "code": 50013} src/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113

    Generated by: Unknown account Feb 21, 2024 at 2:05 AM

Stack trace

#0 src/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 src/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 src/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)
#3 src/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 src/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run(true)
#5 src/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#6 src/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#7 src/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#8 src/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#9 src/vendor/guzzlehttp/guzzle/src/Client.php(182): GuzzleHttp\Promise\Promise->wait()
#10 src/addons/NF/Discord/Api.php(1020): GuzzleHttp\Client->request('PATCH', 'https://discord...', Array)
#11 src/addons/NF/Discord/Api.php(1142): NF\Discord\Api->request(Array, 'guilds/90236943...', Array)
#12 src/addons/NF/Discord/Api.php(365): NF\Discord\Api->patch('guilds/:guildId...', Array)
#13 src/addons/NF/Discord/ApiMessage/AbstractApiUserMessage.php(175): NF\Discord\Api->patchGuildMemberRoles('117667989330461...', Array)
#14 src/addons/NF/Discord/ApiMessage/AbstractApiMessage.php(181): NF\Discord\ApiMessage\AbstractApiUserMessage->NF\Discord\ApiMessage\{closure}()
#15 src/addons/NF/Discord/ApiMessage/AbstractApiUserMessage.php(172): NF\Discord\ApiMessage\AbstractApiMessage->withApiThrow(Object(Closure))
#16 src/addons/NF/Discord/ApiMessage/SyncUser.php(348): NF\Discord\ApiMessage\AbstractApiUserMessage->patchGuildRoles(Object(SV\ReportImprovements\XF\Entity\User), '117667989330461...', Array, false)
#17 src/addons/NF/Discord/ApiMessage/SyncUser.php(236): NF\Discord\ApiMessage\SyncUser->syncRoles()
#18 src/addons/NF/Discord/Repository/Queue.php(365): NF\Discord\ApiMessage\SyncUser->dispatch()
#19 src/addons/NF/Discord/Job/DiscordSendQueue.php(22): NF\Discord\Repository\Queue->run(8)
#20 src/XF/Job/Manager.php(260): NF\Discord\Job\DiscordSendQueue->run(8)
#21 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#22 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)
#23 job.php(43): XF\Job\Manager->runQueue(false, 8)
#24 {main}

Request state

array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => string(32) "https://mountaininteractive.com/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Last edited:
GuzzleHttp\Exception\ClientException: Discord Msg: 8054; Client error: PATCH https://discord.com/api/guilds/902369439545180180/members/1176679893304610899 resulted in a 403 Forbidden response: {"message": "Missing Permissions", "code": 50013} src/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Generated by: Unknown account Feb 21, 2024 at 2:05 AM Stack trace#0 src/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))#1 src/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))#2 src/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)#3 src/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()#4 src/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run(true)#5 src/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()#6 src/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()#7 src/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()#8 src/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()#9 src/vendor/guzzlehttp/guzzle/src/Client.php(182): GuzzleHttp\Promise\Promise->wait()#10 src/addons/NF/Discord/Api.php(1020): GuzzleHttp\Client->request('PATCH', 'https://discord...', Array)#11 src/addons/NF/Discord/Api.php(1142): NF\Discord\Api->request(Array, 'guilds/90236943...', Array)#12 src/addons/NF/Discord/Api.php(365): NF\Discord\Api->patch('guilds/:guildId...', Array)#13 src/addons/NF/Discord/ApiMessage/AbstractApiUserMessage.php(175): NF\Discord\Api->patchGuildMemberRoles('117667989330461...', Array)#14 src/addons/NF/Discord/ApiMessage/AbstractApiMessage.php(181): NF\Discord\ApiMessage\AbstractApiUserMessage->NF\Discord\ApiMessage\{closure}()#15 src/addons/NF/Discord/ApiMessage/AbstractApiUserMessage.php(172): NF\Discord\ApiMessage\AbstractApiMessage->withApiThrow(Object(Closure))#16 src/addons/NF/Discord/ApiMessage/SyncUser.php(348): NF\Discord\ApiMessage\AbstractApiUserMessage->patchGuildRoles(Object(SV\ReportImprovements\XF\Entity\User), '117667989330461...', Array, false)#17 src/addons/NF/Discord/ApiMessage/SyncUser.php(236): NF\Discord\ApiMessage\SyncUser->syncRoles()#18 src/addons/NF/Discord/Repository/Queue.php(365): NF\Discord\ApiMessage\SyncUser->dispatch()#19 src/addons/NF/Discord/Job/DiscordSendQueue.php(22): NF\Discord\Repository\Queue->run(8)#20 src/XF/Job/Manager.php(260): NF\Discord\Job\DiscordSendQueue->run(8)#21 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)#22 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)#23 job.php(43): XF\Job\Manager->runQueue(false, 8)#24 {main}Request statearray(4) { ["url"] => string(8) "/job.php" ["referrer"] => string(32) "https://mountaininteractive.com/" ["_GET"] => array(0) { } ["_POST"] => array(0) { }}
 
That error occurs when the bot attempts to update a user with "more" permissions than it, typically the discord server owner.

This addon can not "switch" Discord users. It uses oauth tokens which are dependant on the end-user granting access. This add-on then only loads the relevant user's oauth token when operating applying or changing discord roles.
 
Last edited:
I've tried to find the answer to this question in the installation guide, and in this thread, but drew a blank, so here goes:

If you have a successfully synced user, who has already been granted the appropriate roles over on the Discord side, and you then change their primary or secondary groups on the XF side, do the Discord roles get updated?
 
If you have a successfully synced user, who has already been granted the appropriate roles over on the Discord side, and you then change their primary or secondary groups on the XF side, do the Discord roles get updated?
I'm not entirely sure what you're asking. If they already have roles on Discord and are granted additional roles by virtue of XF user groups, the add-on will ensure they keep their existing roles and get any new ones that they might be entitled to. It will also, of course, remove any that no longer apply from the XF side.
 
Naz updated Discord Integration with a new update entry:

Version 2.8.5

  • Use password field for bot token and client secret values in the admin panel.
  • Add a per-server "Kick user if they are no longer in allowed user groups" flag.
  • Fix old sync long entries not being pruned as expected.
  • When modifying the XenForo user-group to Discord role mappings, only trigger a re-sync for the affected server to avoid excessive API calls.
Note that some functionality mentioned as being included in the 2.8.4 release was not actually included so this...

Read the rest of this update entry...
 
I'm not entirely sure what you're asking. If they already have roles on Discord and are granted additional roles by virtue of XF user groups, the add-on will ensure they keep their existing roles and get any new ones that they might be entitled to. It will also, of course, remove any that no longer apply from the XF side.
Good stuff, thanks.
The specific problem we had today was a user whose XF primary group had been altered but the Discord role hadn't updated to match. (I've asked the user to disassociate and reassociate to fix it, which I imagine will work.)

However, (cough), I now realise that we aren't using the latest version of the addon... 🤐
 
So I write it here, after an advice... and hopefully this is the right thread?

Hello together

New to this (XenForo and also to the discord add on)!!
Got these error since 3 or 4 days.. I'm new with his and don't know what error it is and how to solve it (sorry).
Installed the Discord Add on from NixFifty. So it depends on it (that what I see)
  • TypeError: XF\Mvc\Entity\Entity::__construct(): Argument #1 ($em) must be of type XF\Mvc\Entity\Manager, XF\Pub\App given, called in /var/www/vhosts/sysops-finest.org/httpdocs/forum/src/XF/Container.php on line 276
  • src/XF/Mvc/Entity/Entity.php:96
  • Generiert von: Unbekanntes Konto
  • 09. März 2024 um 14:07

Stack-Trace​


#0 src/XF/Container.php(276): XF\Mvc\Entity\Entity->__construct(Object(XF\Pub\App), 898, Array)
#1 src/XF/App.php(1687): XF\Container->createObject('NF\\Discord\\Enti...', Array, true)
#2 src/XF/Container.php(234): XF\App->XF\{closure}('NF\\Discord\\Enti...', Array, Object(XF\Container))
#3 src/XF/App.php(3081): XF\Container->create('job', 'NF\\Discord\\Enti...', Array)
#4 src/XF/Job/Manager.php(238): XF\App->job('NF\\Discord\\Enti...', 898, Array)
#5 src/XF/Job/Manager.php(243): XF\Job\Manager->getJobRunner(Array)
#6 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 7.93262)
#7 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 7.93262)
#8 job.php(43): XF\Job\Manager->runQueue(false, 8)
#9 {main}

Status der Anfrage​

array(4) {
["url"] => string(14) "/forum/job.php"
["referrer"] => string(45) "https://www.sysops-finest.org/forum/index.php"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

I know that the error is sitting in front of the monitor!!
So far "I think" the connection to Discord is established. The Add on told everything works well.
Bot is installed and reacts on the heartbeat.
By the way. The website from NixFifty explains how to set up the Bot as always on in a short way.
Is here anybody who can explain this for a "dummy"?

Thank you for your help!

Greetings from germany

Mike
 
Having trouble connecting to the NF site to create a ticket, so I'll ask here for now...
Just updated the addon to 2.8.5 and have realised that a job has been created which is bugging out repeatedly.

The entry in xf_job is "resync-discord-users-1, NF\Discord\Entity\SyncLog"
and the PHP error is
"TypeError: Argument 1 passed to XF\Mvc\Entity\Entity::__construct() must be an instance of XF\Mvc\Entity\Manager, instance of XF\Pub\App given, called in /............./public/src/XF/Container.php on line 276 src/XF/Mvc/Entity/Entity.php:96"

Not sure where to start with this one. Any ideas, anyone?

#0 src/XF/Container.php(276): XF\Mvc\Entity\Entity->__construct(Object(XF\Pub\App), 266647, Array)
#1 src/XF/App.php(1687): XF\Container->createObject('NF\\Discord\\Enti...', Array, true)
#2 src/XF/Container.php(234): XF\App->XF\{closure}('NF\\Discord\\Enti...', Array, Object(XF\Container))
#3 src/XF/App.php(3081): XF\Container->create('job', 'NF\\Discord\\Enti...', Array)
#4 src/XF/Job/Manager.php(238): XF\App->job('NF\\Discord\\Enti...', 266647, Array)
#5 src/XF/Job/Manager.php(243): XF\Job\Manager->getJobRunner(Array)
#6 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#7 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)
#8 job.php(43): XF\Job\Manager->runQueue(false, 8)
#9 {main}
 
Hello! Already got a licence for this, great addon! However it would be a lot better if these features were implemented:

- Allow Discord role to Forums (so if a user has Donator role on the Discord server, it would give them the role on the Forums too)

- Discord Notifications, allow them to link to the thread rather than the alerts page. So if someone made a subforum you're watching, you'd get the Discord notification and it would send you to the thread, rather than the alerts page.

- Slash Commands, allow us to make commands for the Discord server. So we could make a command like /profile [user] and you can search up specific users and show data related to that user. I think the best way to do this is to have pre-made commands and allow us to modify the responses (with variables and such) as well as creating some way to make custom commands, such as using the API. You could allow specific things to be called from the API, and them make an embed for it, and then specify if it's a ephemeral message or not.

- Allow the Discord user to be retrieved with the Xenforo API. Wouldn't be shocked if this is not easily possible, however it would be extremely handy if I could use the API to retrieve the Discord account linked to the Forums account. The intention behind this was for the 1st suggestion that I provided, however it could still be useful nonetheless.

- Multiple Server IDs. We have multiple Discord servers, and something that I personally need is to send a thread to a specific Discord channel that is not our main server.

First being the most needed, the last being the least. Either way, great addon! Hope these suggestions will be implemented in the future.
 
Last edited:
So I write it here, after an advice... and hopefully this is the right thread?

Hello together

New to this (XenForo and also to the discord add on)!!
Got these error since 3 or 4 days.. I'm new with his and don't know what error it is and how to solve it (sorry).
Installed the Discord Add on from NixFifty. So it depends on it (that what I see)
  • TypeError: XF\Mvc\Entity\Entity::__construct(): Argument #1 ($em) must be of type XF\Mvc\Entity\Manager, XF\Pub\App given, called in /var/www/vhosts/sysops-finest.org/httpdocs/forum/src/XF/Container.php on line 276
  • src/XF/Mvc/Entity/Entity.php:96
  • Generiert von: Unbekanntes Konto
  • 09. März 2024 um 14:07

Stack-Trace​


#0 src/XF/Container.php(276): XF\Mvc\Entity\Entity->__construct(Object(XF\Pub\App), 898, Array)
#1 src/XF/App.php(1687): XF\Container->createObject('NF\\Discord\\Enti...', Array, true)
#2 src/XF/Container.php(234): XF\App->XF\{closure}('NF\\Discord\\Enti...', Array, Object(XF\Container))
#3 src/XF/App.php(3081): XF\Container->create('job', 'NF\\Discord\\Enti...', Array)
#4 src/XF/Job/Manager.php(238): XF\App->job('NF\\Discord\\Enti...', 898, Array)
#5 src/XF/Job/Manager.php(243): XF\Job\Manager->getJobRunner(Array)
#6 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 7.93262)
#7 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 7.93262)
#8 job.php(43): XF\Job\Manager->runQueue(false, 8)
#9 {main}

Status der Anfrage​

array(4) {
["url"] => string(14) "/forum/job.php"
["referrer"] => string(45) "https://www.sysops-finest.org/forum/index.php"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}

I know that the error is sitting in front of the monitor!!
So far "I think" the connection to Discord is established. The Add on told everything works well.
Bot is installed and reacts on the heartbeat.
By the way. The website from NixFifty explains how to set up the Bot as always on in a short way.
Is here anybody who can explain this for a "dummy"?

Thank you for your help!

Greetings from germany

Mike

Having trouble connecting to the NF site to create a ticket, so I'll ask here for now...
Just updated the addon to 2.8.5 and have realised that a job has been created which is bugging out repeatedly.

The entry in xf_job is "resync-discord-users-1, NF\Discord\Entity\SyncLog"
and the PHP error is
"TypeError: Argument 1 passed to XF\Mvc\Entity\Entity::__construct() must be an instance of XF\Mvc\Entity\Manager, instance of XF\Pub\App given, called in /............./public/src/XF/Container.php on line 276 src/XF/Mvc/Entity/Entity.php:96"

Not sure where to start with this one. Any ideas, anyone?

#0 src/XF/Container.php(276): XF\Mvc\Entity\Entity->__construct(Object(XF\Pub\App), 266647, Array)
#1 src/XF/App.php(1687): XF\Container->createObject('NF\\Discord\\Enti...', Array, true)
#2 src/XF/Container.php(234): XF\App->XF\{closure}('NF\\Discord\\Enti...', Array, Object(XF\Container))
#3 src/XF/App.php(3081): XF\Container->create('job', 'NF\\Discord\\Enti...', Array)
#4 src/XF/Job/Manager.php(238): XF\App->job('NF\\Discord\\Enti...', 266647, Array)
#5 src/XF/Job/Manager.php(243): XF\Job\Manager->getJobRunner(Array)
#6 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#7 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)
#8 job.php(43): XF\Job\Manager->runQueue(false, 8)
#9 {main}
Took a while to track this down but should be sorted in 2.8.6.
 
Top Bottom