simple-robot / simpler-robot

Simple Robot,一个bot风格的Kotlin多平台事件调度框架,异步高效、Java友好!/ A Bot-style Kotlin Multiplatform event scheduling framework, asynchronous and high-performance, java-friendly! 🐱😼😻😸
https://simbot.forte.love
GNU Lesser General Public License v3.0
520 stars 43 forks source link

Kook组件 角色相关功能 #618

Closed ForteScarlet closed 1 year ago

ForteScarlet commented 1 year ago

Discussed in https://github.com/orgs/simple-robot/discussions/100

Originally posted by **HeilantG** March 8, 2023 ### 涉及的编程语言 Java ### 涉及的组件库 kook ### 疑问描述 希望实现下列功能 1. 获取服务器角色 2. 获取用户角色 3. 赋予用户角色 4. 删除用户角色 kook相关接口开发文档地址: https://developer.kookapp.cn/doc/http/guild-role
ForteScarlet commented 1 year ago

@HeilantG 底层API已经有实现,如果想通过提前使用可参考 https://docs.simbot.forte.love/components/kook/simbot-component-kook-api/love.forte.simbot.kook.api.guild.role/index.html 以查询 role-list 为例:

public void run(KookComponentBot bot) {
        GuildRoleListRequest roleListApi = GuildRoleListRequest.create(Identifies.ID("abcd"));
        KookApiResult.ListData<? extends Role> roleListData = roleListApi.requestBlockingBy(bot.getSourceBot());
        List<? extends Role> roles = roleListData.getItems();
}

但是注意 https://github.com/simple-robot/simbot-component-kook/issues/82 ,API模块和标准库模块会大面积重构,如果使用底层API注意预留未来重构调整的空间。