characters 角色
角色信息获取模块。
python
from bestdori import characters
类型定义
CharacterInfo 角色信息
角色详细信息字典。 all.{index}.json
/ main.{index}.json
信息字典为该字典中选取部分字段信息。
字段名 | 类型 | 描述 |
---|---|---|
characterType | str | 角色类型 |
characterName | List[str | None] | 角色姓名定长列表 |
nickname | List[str | None] | 角色昵称定长列表 |
bandId NotRequired | int | 角色所在乐队 ID 。非主要角色不存在此项 |
colorCode NotRequired | str | 角色代表色十六进制码。非主要角色不存在此项 |
firstName | str | 角色名定长列表 |
lastName | str | 角色姓氏定长列表 |
seasonCostumeListMap NotRequired | SeasonCostumeListMap | 角色某季服装列表映射表 |
sdAssetBundleName | str | 角色 SD 资源资源库名 |
defaultCostumeId NotRequired | int | 默认服装 ID 。非主要角色不存在此项 |
ruby | List[str | None] | 角色读音注释定长列表 |
profile NotRequired | Profile | 角色个人资料 |
SeasonCostumeListMap
字段名 | 类型 | 描述 |
---|---|---|
entries | SeasonCostumeListMapentrieseason | 季 ID 与服装列表映射字典 |
SeasonCostumeListMapentrieseason
字段名 | 类型 | 描述 |
---|---|---|
entries | List[SeasonCostumeListMapentrieseasonEntry] | 服装列表 |
SeasonCostumeListMapentrieseasonEntry
字段名 | 类型 | 描述 |
---|---|---|
characterId | int | 角色 ID |
basicSeasonId | int | - |
costumeType | str | 服装类型 |
seasonCostumeType | str | - |
sdAssetBundleName | str | LIVESD 资源资源库名 |
live2dAssetBundleName | str | Live2D 资源资源库名 |
seasonType | str | 季 ID |
Profile 角色个人资料
角色个人信息字典。
字段名 | 类型 | 描述 |
---|---|---|
characterVoice | List[str | None] | 角色声优名定长列表 |
favoriteFood | List[str | None] | 角色喜好食物定长列表 |
hatedFood | List[str | None] | 角色厌恶食物定长列表 |
hobby | List[str | None] | 角色习惯定长列表 |
selfIntroduction | List[str | None] | 角色自我介绍定长列表 |
school | List[str | None] | 角色学校名称定长列表 |
schoolCls | List[str | None] | 角色所在班级定长列表 |
schoolYear | List[str | None] | 角色所在学年定长列表 |
part | str | 角色担当 |
birthday | str | 角色生日时间戳 |
constellation | str | 角色星座名 |
height | float | 角色身高 (cm) |
def get_all() async
参数名 | 类型 | 默认值 | 描述 |
---|---|---|---|
index | int | 0 | 指定获取的 JSON 信息 |
me keyword | Optional[Me] | None | 登录用户类 |
获取总角色信息,返回以角色 ID 为字段名、 CharacterAllInfo
为字段值的信息字典, CharacterAllInfo
为从 CharacterInfo
中截取出的部分信息。根据 index
参数值不同,获取到的 CharacterAllInfo
所包含的信息也不同。
特别地,当 index
值为 0
时,返回值为以角色 ID 为字段名、 NoneDict
为字段值的字典
index 可用参数值
参数值 | 获取字段值末项字段名 |
---|---|
0 | - |
2 | colorCode |
5 | seasonCostumeListMap |
Dict[str, CharacterAllInfo | NoneDict]
def get_main() async
参数名 | 类型 | 默认值 | 描述 |
---|---|---|---|
index | int | 0 | 指定获取的 JSON 信息 |
me keyword | Optional[Me] | None | 登录用户类 |
获取主要角色信息,返回以卡牌 ID 为字段名、 CharacterMainInfo
为字段值的信息字典, CharacterMainInfo
为从 CharacterInfo
中截取出的部分信息。根据 index
参数值不同,获取到的 CharacterMainInfo
所包含的信息也不同。
特别地,当 index
值为 0
时,返回值为以角色 ID 为字段名、 NoneDict
为字段值的字典
index 可用参数值
参数值 | 获取字段值相对新增字段名 |
---|---|
0 | - |
1 | characterType , bandId |
2 | characterName , nickname , colorCode |
3 | firstName , lastName |
Dict[str, CharacterMainInfo | NoneDict]
class Character()
角色类,包含各种角色相关资源整合。
def init()
参数名 | 类型 | 默认值 | 描述 |
---|---|---|---|
id | int | - | 角色 ID |
me keyword | Optional[Me] | None | 登录用户类 |
def get_info() async
获取角色信息。
返回值:CharactersInfo
def get_comment() async
参数名 | 类型 | 默认值 | 描述 |
---|---|---|---|
limit | int | 20 | 获取到的帖子数量上限 |
offset | int | 0 | 获取帖子时的偏移量 |
order | Order | 'TIME_ASC' |
获取角色的社区评论列表。
返回值:PostList
def get_icon() async
获取角色图标资源。
返回值:bytes
def get_kv_image() async
获取角色主视觉图资源。
返回值:bytes