# Discord同步：将Discourse论坛与Discord服务器同步

**URL:** <https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864>\
**Category:** Plugin\
**Tags:** unmaintained\
**Created:** [2021年一月12日 11:47 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864 "2021-01-12T11:47:26Z")\
**Posts on this page:** 13\
**Page:** 2

<div class="post-metadata">

**Author:** ![spirobel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/spirobel/32/170908_2.png) [@spirobel](https://meta.discourse.org/u/spirobel)\
**Post date:** [2022年一月24日 14:32 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/27 "2022-01-24T14:32:26Z")

</div>

> [@Nerd\_Alert](#):
>
> 太荒谬了。

确实很便宜。对这个用例感兴趣并愿意为此付费的人不多。研究这些主题、编写和维护软件都需要时间。这些都不是免费的，如果客户不多，价格就会反映出来。  
另一个问题是：价格越低，客户的要求就越多。我没有时间处理那些花了 25 美元购买的人的支持问题和疑问。  
如果您有关于如何在低价销售的同时赚钱而不被骚扰的建议，请告诉我。

---

<div class="post-metadata">

**Author:** ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)\
**Post date:** [2022年一月27日 00:08 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/28 "2022-01-27T00:08:24Z")

</div>

是的，我记得联系过他们关于使用他们的插件，而且我完全理解他们为什么会收取那么高的费用。我知道许多社区能够负担得起这个价格，但对于较小的社区来说，这并不一定负担得起。

我最终通过在我的 Discord 机器人（基于 Java，因为我认为我目前还无法完全通过 Discourse 插件轻松实现这一点）中添加功能来自己解决了这个问题，它还具有一些双向逻辑的附加功能。未来，我希望在我的 Discord 机器人完成后将此功能公之于众，但这将取决于我拥有的空闲时间。如果有人想看看，这是我的机器人运行时的样子：[https://p185.p2.n0.cdn.getcloudapp.com/items/4guZZEP1/b138570f-071c-4373-ada5-b7ed2cd63b26.mp4](https://p185.p2.n0.cdn.getcloudapp.com/items/4guZZEP1/b138570f-071c-4373-ada5-b7ed2cd63b26.mp4)

另外，如果有人有兴趣在我公开此功能后成为 beta 测试者，请随时给我发私信——我没有关于何时能完成的预计时间，但如果需要，我可能会考虑将其作为一个独立的功能。

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2022年一月27日 08:34 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/29 "2022-01-27T08:34:40Z")

</div>

您是否意识到这里已经存在一个 Discourse Discord Bot 框架，您可以对其进行分叉、修改和扩展？[https://meta.discourse.org/t/discord-bot-run-one-on-your-discourse-server-keep-things-in-sync/122530。它完成了](https://meta.discourse.org/t/discord-bot-run-one-on-your-discourse-server-keep-things-in-sync/122530%E3%80%82%E5%AE%83%E5%AE%8C%E6%88%90%E4%BA%86) 99% 的管理工作，因此您可以专注于功能方面（它甚至可以在您的 Discourse 服务器上运行，无需额外的基础设施）。现有功能可以作为您想要添加的任何内容的指南。

如果您能提出对其他社区有用的功能，我也将接受 PR。

---

<div class="post-metadata">

**Author:** ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)\
**Post date:** [2022年一月27日 14:57 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/30 "2022-01-27T14:57:32Z")

</div>

我好像确实看到过——我只是不熟悉 Ruby，所以我直接将这个功能添加到了我已经在使用的、并且已经开发了多年的机器人中，而不是使用 Discourse。我绝对会考虑为此提交一个 PR（Pull Request），但当我为我的社区编写这个功能时，我时间紧迫，学习 Ruby 根本不可能。我绝对会考虑将 Ruby 作为我的下一个编程语言，并尝试一下！😀

编辑：另外，谢谢你提到它易于自定义——我一开始没意识到。我上次尝试修改 Discourse 插件时被吓到了 lol

---

<div class="post-metadata">

**Author:** ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)\
**Post date:** [2022年一月27日 15:22 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/31 "2022-01-27T15:22:41Z")

</div>

给 Ruby 一个机会吧，它实际上是一门有趣的编程语言 🙂

---

<div class="post-metadata">

**Author:** ![workwithsarthak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/workwithsarthak/32/252176_2.png) [@workwithsarthak](https://meta.discourse.org/u/workwithsarthak)\
**Post date:** [2022年三月6日 14:25 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/32 "2022-03-06T14:25:35Z")

</div>

我在测试此插件时遇到问题，在所有设置完成后，测试过程中出现了一些权限错误。  
Discordrb::Errors::NoPermission (机器人没有执行此操作所需的权限！) lib/promotion.rb:136:in `recalculate' app/models/group_user.rb:117:in `recalculate\_trust\_level’

附上截图供参考：

 ![image](https://global.discourse-cdn.com/meta/original/3X/c/a/ca34a2543b7c7728819c358771dea884fc5454fd.png)

有人能帮帮我吗？

---

<div class="post-metadata">

**Author:** ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)\
**Post date:** [2022年三月25日 00:04 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/33 "2022-03-25T00:04:55Z")

</div>

您的 Discord 机器人是否正确设置了权限？您需要将机器人置于它将要分配的任何角色的上方，并且需要为机器人的角色授予“管理角色”或“管理员”权限。

---

<div class="post-metadata">

**Author:** ![workwithsarthak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/workwithsarthak/32/252176_2.png) [@workwithsarthak](https://meta.discourse.org/u/workwithsarthak)\
**Post date:** [2022年三月25日 17:26 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/34 "2022-03-25T17:26:53Z")

</div>

是的，我们已提供所有权限，包括管理员、管理角色、管理昵称。

---

<div class="post-metadata">

**Author:** ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)\
**Post date:** [2022年三月25日 17:27 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/35 "2022-03-25T17:27:27Z")

</div>

该角色是否高于它将要分配的所有其他角色？

---

<div class="post-metadata">

**Author:** ![sunjam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sunjam/32/175682_2.png) [@sunjam](https://meta.discourse.org/u/sunjam)\
**Post date:** [2022年三月26日 16:12 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/36 "2022-03-26T16:12:52Z")

</div>

此插件在我们的服务器上未启用，但导致日志中出现错误。

> **gateway\_check 错误**
>
> discordrb (3.3.0) lib/discordrb/bot.rb:673:in `gateway\_check’
> 
> discordrb (3.3.0) lib/discordrb/bot.rb:156:in `servers’
> 
> plugins/discourse-discord-sync/lib/utils.rb:72:in `sync\_user’
> 
> plugins/discourse-discord-sync/plugin.rb:42:in `block (3 levels) in activate!’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:427:in `instance\_exec’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:427:in `block in make\_lambda’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:235:in `block in halting\_and\_conditional’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:516:in `block in invoke\_after’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:516:in `each’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:516:in `invoke\_after’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:131:in `block in run\_callbacks’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:137:in `run\_callbacks’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:824:in `\_run\_save\_callbacks’
> 
> activerecord (6.1.4.1) lib/active\_record/callbacks.rb:457:in `create\_or\_update’
> 
> activerecord (6.1.4.1) lib/active\_record/timestamp.rb:126:in `create\_or\_update’
> 
> activerecord (6.1.4.1) lib/active\_record/persistence.rb:474:in `save’
> 
> activerecord (6.1.4.1) lib/active\_record/validations.rb:47:in `save’
> 
> activerecord (6.1.4.1) lib/active\_record/transactions.rb:298:in `block in save’
> 
> activerecord (6.1.4.1) lib/active\_record/transactions.rb:354:in `block in with\_transaction\_returning\_status’
> 
> activerecord (6.1.4.1) lib/active\_record/connection\_adapters/abstract/database\_statements.rb:318:in `transaction’
> 
> activerecord (6.1.4.1) lib/active\_record/transactions.rb:350:in `with\_transaction\_returning\_status’
> 
> activerecord (6.1.4.1) lib/active\_record/transactions.rb:298:in `save’
> 
> activerecord (6.1.4.1) lib/active\_record/suppressor.rb:44:in `save’
> 
> activerecord (6.1.4.1) lib/active\_record/persistence.rb:628:in `block in update’
> 
> activerecord (6.1.4.1) lib/active\_record/transactions.rb:354:in `block in with\_transaction\_returning\_status’
> 
> activerecord (6.1.4.1) lib/active\_record/connection\_adapters/abstract/database\_statements.rb:318:in `transaction’
> 
> activerecord (6.1.4.1) lib/active\_record/transactions.rb:350:in `with\_transaction\_returning\_status’
> 
> activerecord (6.1.4.1) lib/active\_record/persistence.rb:626:in `update’
> 
> lib/post\_creator.rb:613:in `update\_user\_counts’
> 
> lib/post\_creator.rb:214:in `block in create’
> 
> lib/post\_creator.rb:408:in `block (2 levels) in transaction’
> 
> activerecord (6.1.4.1) lib/active\_record/connection\_adapters/abstract/database\_statements.rb:320:in `block in transaction’
> 
> activerecord (6.1.4.1) lib/active\_record/connection\_adapters/abstract/transaction.rb:319:in `block in within\_new\_transaction’
> 
> activesupport (6.1.4.1) lib/active\_support/concurrency/load\_interlock\_aware\_monitor.rb:26:in `block (2 levels) in synchronize’
> 
> activesupport (6.1.4.1) lib/active\_support/concurrency/load\_interlock\_aware\_monitor.rb:25:in `handle\_interrupt’
> 
> activesupport (6.1.4.1) lib/active\_support/concurrency/load\_interlock\_aware\_monitor.rb:25:in `block in synchronize’
> 
> activesupport (6.1.4.1) lib/active\_support/concurrency/load\_interlock\_aware\_monitor.rb:21:in `handle\_interrupt’
> 
> activesupport (6.1.4.1) lib/active\_support/concurrency/load\_interlock\_aware\_monitor.rb:21:in `synchronize’
> 
> activerecord (6.1.4.1) lib/active\_record/connection\_adapters/abstract/transaction.rb:317:in `within\_new\_transaction’
> 
> activerecord (6.1.4.1) lib/active\_record/connection\_adapters/abstract/database\_statements.rb:320:in `transaction’
> 
> activerecord (6.1.4.1) lib/active\_record/transactions.rb:209:in `transaction’
> 
> lib/post\_creator.rb:407:in `block in transaction’
> 
> lib/distributed\_mutex.rb:33:in `block in synchronize’
> 
> lib/distributed\_mutex.rb:29:in `synchronize’
> 
> lib/distributed\_mutex.rb:29:in `synchronize’
> 
> lib/distributed\_mutex.rb:14:in `synchronize’
> 
> lib/post\_creator.rb:406:in `transaction’
> 
> lib/post\_creator.rb:204:in `create’
> 
> lib/new\_post\_manager.rb:285:in `perform\_create\_post’
> 
> lib/new\_post\_manager.rb:223:in `perform’
> 
> app/controllers/posts\_controller.rb:197:in `create’
> 
> actionpack (6.1.4.1) lib/action\_controller/metal/basic\_implicit\_render.rb:6:in `send\_action’
> 
> actionpack (6.1.4.1) lib/abstract\_controller/base.rb:228:in `process\_action’
> 
> actionpack (6.1.4.1) lib/action\_controller/metal/rendering.rb:30:in `process\_action’
> 
> actionpack (6.1.4.1) lib/abstract\_controller/callbacks.rb:42:in `block in process\_action’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:117:in `block in run\_callbacks’
> 
> app/controllers/application\_controller.rb:387:in `block in with\_resolved\_locale’
> 
> i18n (1.9.1) lib/i18n.rb:328:in `with\_locale’
> 
> app/controllers/application\_controller.rb:387:in `with\_resolved\_locale’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:126:in `block in run\_callbacks’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:137:in `run\_callbacks’
> 
> actionpack (6.1.4.1) lib/abstract\_controller/callbacks.rb:41:in `process\_action’
> 
> actionpack (6.1.4.1) lib/action\_controller/metal/rescue.rb:22:in `process\_action’
> 
> actionpack (6.1.4.1) lib/action\_controller/metal/instrumentation.rb:34:in `block in process\_action’
> 
> activesupport (6.1.4.1) lib/active\_support/notifications.rb:203:in `block in instrument’
> 
> activesupport (6.1.4.1) lib/active\_support/notifications/instrumenter.rb:24:in `instrument’
> 
> activesupport (6.1.4.1) lib/active\_support/notifications.rb:203:in `instrument’
> 
> actionpack (6.1.4.1) lib/action\_controller/metal/instrumentation.rb:33:in `process\_action’
> 
> actionpack (6.1.4.1) lib/action\_controller/metal/params\_wrapper.rb:249:in `process\_action’
> 
> activerecord (6.1.4.1) lib/active\_record/railties/controller\_runtime.rb:27:in `process\_action’
> 
> actionpack (6.1.4.1) lib/abstract\_controller/base.rb:165:in `process’
> 
> actionview (6.1.4.1) lib/action\_view/rendering.rb:39:in `process’
> 
> rack-mini-profiler (2.3.3) lib/mini\_profiler/profiling\_methods.rb:85:in `block in profile\_method’
> 
> actionpack (6.1.4.1) lib/action\_controller/metal.rb:190:in `dispatch’
> 
> actionpack (6.1.4.1) lib/action\_controller/metal.rb:254:in `dispatch’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/routing/route\_set.rb:50:in `dispatch’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/routing/route\_set.rb:33:in `serve’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/journey/router.rb:50:in `block in serve’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/journey/router.rb:32:in `each’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/journey/router.rb:32:in `serve’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/routing/route\_set.rb:842:in `call’
> 
> lib/middleware/omniauth\_bypass\_middleware.rb:71:in `call’
> 
> rack (2.2.3) lib/rack/tempfile\_reaper.rb:15:in `call’
> 
> rack (2.2.3) lib/rack/conditional\_get.rb:40:in `call’
> 
> rack (2.2.3) lib/rack/head.rb:12:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/http/permissions\_policy.rb:22:in `call’
> 
> lib/content\_security\_policy/middleware.rb:12:in `call’
> 
> lib/middleware/anonymous\_cache.rb:356:in `call’
> 
> rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context’
> 
> rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/cookies.rb:689:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/callbacks.rb:27:in `block in call’
> 
> activesupport (6.1.4.1) lib/active\_support/callbacks.rb:98:in `run\_callbacks’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/callbacks.rb:26:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/actionable\_exceptions.rb:18:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/debug\_exceptions.rb:29:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/show\_exceptions.rb:33:in `call’
> 
> logster (2.10.1) lib/logster/middleware/reporter.rb:43:in `call’
> 
> railties (6.1.4.1) lib/rails/rack/logger.rb:37:in `call\_app’
> 
> railties (6.1.4.1) lib/rails/rack/logger.rb:28:in `call’
> 
> config/initializers/100-quiet\_logger.rb:23:in `call’
> 
> config/initializers/100-silence\_logger.rb:31:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/remote\_ip.rb:81:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/request\_id.rb:26:in `call’
> 
> lib/middleware/enforce\_hostname.rb:23:in `call’
> 
> rack (2.2.3) lib/rack/method\_override.rb:24:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/executor.rb:14:in `call’
> 
> rack (2.2.3) lib/rack/sendfile.rb:110:in `call’
> 
> actionpack (6.1.4.1) lib/action\_dispatch/middleware/host\_authorization.rb:92:in `call’
> 
> rack-mini-profiler (2.3.3) lib/mini\_profiler/

---

<div class="post-metadata">

**Author:** ![workwithsarthak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/workwithsarthak/32/252176_2.png) [@workwithsarthak](https://meta.discourse.org/u/workwithsarthak)\
**Post date:** [2022年四月4日 01:35 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/37 "2022-04-04T01:35:04Z")

</div>

是的，我们已经提供了超级管理员！

---

<div class="post-metadata">

**Author:** ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)\
**Post date:** [2023年一月5日 10:35 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/47 "2023-01-05T10:35:04Z")

</div>

只是为了确认一下——这个插件是否仍然可用，或者我应该给它加上 #unmaintained / #broken 标签？

---

<div class="post-metadata">

**Author:** ![ernestdefoe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ernestdefoe/32/118137_2.png) [@ernestdefoe](https://meta.discourse.org/u/ernestdefoe)\
**Post date:** [2024年五月7日 03:14 UTC](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864/56 "2024-05-07T03:14:07Z")

</div>

> [@barreeeiroo](#):
>
> ```plaintext
> hooks:
> before_code:
> - exec:
> cmd:
> - apt-get update
> - apt-get install -y libsodium-dev
> 
> ```

我已经将此添加到我的 app.yml 文件中，但不知何故它仍然没有安装 libsodium。我哪里做错了？

[上一頁](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864.md?page=1)
