Skip to content

characters 角色

角色信息获取模块。

python
from bestdori import characters

类型定义

CharacterInfo 角色信息

角色详细信息字典。 all.{index}.json / main.{index}.json 信息字典为该字典中选取部分字段信息。

字段名类型描述
characterTypestr角色类型
characterNameList[str | None]角色姓名定长列表
nicknameList[str | None]角色昵称定长列表
bandId NotRequiredint角色所在乐队 ID 。非主要角色不存在此项
colorCode NotRequiredstr角色代表色十六进制码。非主要角色不存在此项
firstNamestr角色名定长列表
lastNamestr角色姓氏定长列表
seasonCostumeListMap NotRequiredSeasonCostumeListMap角色某季服装列表映射表
sdAssetBundleNamestr角色 SD 资源资源库名
defaultCostumeId NotRequiredint默认服装 ID 。非主要角色不存在此项
rubyList[str | None]角色读音注释定长列表
profile NotRequiredProfile角色个人资料

SeasonCostumeListMap

字段名类型描述
entriesSeasonCostumeListMapentrieseason季 ID 与服装列表映射字典

SeasonCostumeListMapentrieseason

字段名类型描述
entriesList[SeasonCostumeListMapentrieseasonEntry]服装列表

SeasonCostumeListMapentrieseasonEntry

字段名类型描述
characterIdint角色 ID
basicSeasonIdint-
costumeTypestr服装类型
seasonCostumeTypestr-
sdAssetBundleNamestrLIVESD 资源资源库名
live2dAssetBundleNamestrLive2D 资源资源库名
seasonTypestr季 ID

Profile 角色个人资料

角色个人信息字典。

字段名类型描述
characterVoiceList[str | None]角色声优名定长列表
favoriteFoodList[str | None]角色喜好食物定长列表
hatedFoodList[str | None]角色厌恶食物定长列表
hobbyList[str | None]角色习惯定长列表
selfIntroductionList[str | None]角色自我介绍定长列表
schoolList[str | None]角色学校名称定长列表
schoolClsList[str | None]角色所在班级定长列表
schoolYearList[str | None]角色所在学年定长列表
partstr角色担当
birthdaystr角色生日时间戳
constellationstr角色星座名
heightfloat角色身高 (cm)

def get_all() async

参数名类型默认值描述
indexint0指定获取的 JSON 信息
me keywordOptional[Me]None登录用户类

获取总角色信息,返回以角色 ID 为字段名、 CharacterAllInfo 为字段值的信息字典, CharacterAllInfo 为从 CharacterInfo 中截取出的部分信息。根据 index 参数值不同,获取到的 CharacterAllInfo 所包含的信息也不同。

特别地,当 index 值为 0 时,返回值为以角色 ID 为字段名、 NoneDict 为字段值的字典

index 可用参数值
参数值获取字段值末项字段名
0-
2colorCode
5seasonCostumeListMap
返回值: Dict[str, CharacterAllInfo | NoneDict]

def get_main() async

参数名类型默认值描述
indexint0指定获取的 JSON 信息
me keywordOptional[Me]None登录用户类

获取主要角色信息,返回以卡牌 ID 为字段名、 CharacterMainInfo 为字段值的信息字典, CharacterMainInfo 为从 CharacterInfo 中截取出的部分信息。根据 index 参数值不同,获取到的 CharacterMainInfo 所包含的信息也不同。

特别地,当 index 值为 0 时,返回值为以角色 ID 为字段名、 NoneDict 为字段值的字典

index 可用参数值
参数值获取字段值相对新增字段名
0-
1characterType, bandId
2characterName, nickname, colorCode
3firstName, lastName
返回值: Dict[str, CharacterMainInfo | NoneDict]

class Character()

角色类,包含各种角色相关资源整合。

def init()

参数名类型默认值描述
idint-角色 ID
me keywordOptional[Me]None登录用户类

def get_info() async

获取角色信息。

返回值: CharactersInfo

def get_comment() async

参数名类型默认值描述
limitint20获取到的帖子数量上限
offsetint0获取帖子时的偏移量
orderOrder'TIME_ASC'

获取角色的社区评论列表。

返回值: PostList

def get_icon() async

获取角色图标资源。

返回值: bytes

def get_kv_image() async

获取角色主视觉图资源。

返回值: bytes