Skip to content

如何操作频道玩家身份 #171

Answered by ForteScarlet
Ligzsir asked this question in Q&A
Discussion options

You must be logged in to vote

如果是指对 "服务器角色" 的操作,参考 KookRole。在核心库中与之相关的操作例如:

@Listener
 public void handler(KookMemberJoinedGuildEvent event) {
        // 比如有个频道服务器
        final KookGuild guild = event.getGuild();

        // 获取并遍历频道服务器中的角色列表
        guild.getRoles().collect(role -> {
            // ...
        });

        // 创建新的服务器角色
        final KookGuildRole newRole = guild.roleCreator()
                .name("角色名称")
                .createBlocking();

        // 删除某个服务器角色
        newRole.deleteBlocking();

        // 假设有个成员
        final var member = guild.getMember(Identifies.ID("abcd"));

        // 将角色授予指定成员
        newRole.grantToBlocking(member);

        // 也能直接用ID授予
        newRole.grantToBlocking(Identi…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@Ligzsir
Comment options

@Ligzsir
Comment options

@ForteScarlet
Comment options

@Ligzsir
Comment options

Answer selected by ForteScarlet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
组件:KOOK 与Kook组件相关的内容
2 participants