公会最高角色司令部? [英] Guilds Highest Role Command?
本文介绍了公会最高角色司令部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想通过discord.js在公会中扮演最高的角色
I want to get the highest role in the guild with discord.js
message.guild.roles.highestRole
这不起作用.任何帮助,将不胜感激.从现在开始谢谢:)
This doesn't work. Any help would be appreciated. Thanks from now :)
推荐答案
-
对于discord.js v12/master,请使用对于discord.js v11.4.x/稳定使用
message.guild.roles
.sort((b,a)=> a.position-b.position || a.id-b.id)
.first()
.name
,这将按角色Collection的位置对其进行排序,然后获得最高的角色,并返回其名称.For discord.js v11.4.x / stable use
message.guild.roles
.sort((b, a) => a.position - b.position || a.id - b.id)
.first()
.name
, this will sort the roles Collection by their position and then get the highest one, and return the name of it.这篇关于公会最高角色司令部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文