如何使用discord.js创建角色 [英] How to create a role with discord.js
问题描述
我一直在尝试使用discord.js创建一个discord机器人,但是我似乎找不到任何有关如何创建在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创建角色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!