# 授予Discord角色时自动创建用户？

**URL:** https://meta.discourse.org/t/creat-a-user-automatically-when-granted-a-discord-role/219918
**Category:** SSO
**Created:** [2022年三月3日 04:09 UTC](https://meta.discourse.org/t/creat-a-user-automatically-when-granted-a-discord-role/219918 "2022-03-03T04:09:58Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![DyNite](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dynite/32/251678_2.png) [@DyNite](https://meta.discourse.org/u/DyNite)
#### Post date: [2022年三月3日 04:09 UTC](https://meta.discourse.org/t/creat-a-user-automatically-when-granted-a-discord-role/219918/1 "2022-03-03T04:09:59Z")

</div>

我们的大部分流量都通过 Discord，但部分需要撰写提案的成员使用 Discourse。

是否有人遇到过类似的情况或提出过类似的要求？

1. 用户注册并将其 Discord 账户连接到 Discourse  
（通过这种方式注册或之后连接）
2. 用户可能会根据 Discord 角色自动添加到 Discourse 中的群组。  
我希望这些特定群组能够同步用户，以便将其添加到 Discord 中的群组。

---

<div class="post-metadata">

### Author: ![osioke](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/osioke/32/238946_2.png) [@osioke](https://meta.discourse.org/u/osioke)
#### Post date: [2022年三月3日 16:46 UTC](https://meta.discourse.org/t/creat-a-user-automatically-when-granted-a-discord-role/219918/2 "2022-03-03T16:46:41Z")

</div>

您是否能够在论坛上搜索过这方面以往的工作？有过很多相关的讨论和官方赞助的工作。这个主题：[Discourse Trust Levels for Discord](https://meta.discourse.org/t/discourse-trust-levels-for-discord/108232/) 包含了一些这些讨论以及指向您正在寻找的内容的不同主题的链接。搜索 [Search results for 'sign up with discord' - Discourse Meta](https://meta.discourse.org/search?context=topic&context_id=219918&q=sign%20up%20with%20discord&skip_context=true) 或其他类似的短语会显示更多主题。

---

<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年三月3日 17:14 UTC](https://meta.discourse.org/t/creat-a-user-automatically-when-granted-a-discord-role/219918/3 "2022-03-03T17:14:40Z")

</div>

对于用户创建，请使用 Discord 登录的开箱即用行为。

对于群组成员资格，您需要考虑更复杂的情况。

@spirobel 有一个插件可以同步 Discord 角色 → Discourse 群组，但他收费（对他来说是好事），所以也许可以私下与他讨论？

如果您想为主要的开源 Discord/Discourse 机器人项目做出贡献，请查看：

> [@Discord Bot Construction Kit robot](https://meta.discourse.org/t/discord-bot-construction-kit/122530):
>
> Purpose of this plugin This plugin does several things: Allows you to power a Discord bot using your Discourse server to do stuff to link the two systems. Fork this repo and expand it with simple Ruby to create all kinds of bot functionality. Existing functionality to serve as examples and useful utility: Provides some two-way auto posting of content that meet some criteria. Command to copy messages ad hoc to Discourse Command to sync group membership to role membership of your Discor…

（但请注意，它目前没有完全自动同步（它是命令触发的），并且无论如何它会同步反方向，但无论如何都能为您打下基础。）

还有这个插件，但它似乎没有得到积极支持，并且同样是反方向的。它基于我的代码：[Discord Sync: sync a Discourse forum with a Discord server](https://meta.discourse.org/t/discord-sync-sync-a-discourse-forum-with-a-discord-server/175864?u=merefield%E3%80%82%E8%BF%98%E6%9C%89%E4%B8%80%E4%B8%AA%E5%85%B3%E4%BA%8E%E8%AF%A5%E4%B8%BB%E9%A2%98%E7%9A%84%E6%9C%89%E7%94%A8%E8%AE%A8%E8%AE%BA%E5%9C%A8%E4%B8%8B%E9%9D%A2%E3%80%82)
