How to create a role with discord.js(如何使用 discord.js 创建角色)
问题描述
我一直在尝试使用 discord.js 制作一个不和谐机器人,但我似乎找不到任何有关如何创建在 2018 年工作的角色的文档.所有我能找到的工作,不再工作,因为他们已经删除了引用的功能.在 https://discord.js.org/#/docs/main/stable/class/Role 没有提到 createRole("role", "roleName");类型函数.
I've been trying to make a discord bot using discord.js, but I can't seem to find any documentation on how to create a role that works in 2018. All the ones I can find that work, no longer work as they have removed the referenced function. In https://discord.js.org/#/docs/main/stable/class/Role there is no mention of a createRole("role", "roleName"); type function.
如果有人可以提供帮助,那就太好了!
If anyone could help that would be great!
推荐答案
Role
类没有创建新角色的方法,必须看Guild
上课.这是该方法的文档链接:https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=createRole.如果您有任何问题,请随时发表评论!
The class Role
does not have the method to create a new role, you must look at the Guild
class for that. Here is a link to the documentation for the method: https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=createRole. Feel free to comment back if you have any questions!
从 discord.js v12 开始,createRole
不再存在,请参阅上面 cecomp64 关于使用新 RoleManager创建新角色的回答代码>对象.
这篇关于如何使用 discord.js 创建角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 discord.js 创建角色


基础教程推荐
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- 直接将值设置为滑块 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01