Documentation ¶
Index ¶
- Constants
- func AddSubscription(sub Subscription) error
- func DeleteSubscription(sub Subscription) error
- func DynamicTypePicMessage(d DynamicInfo) (m []message.MessageSegment)
- func DynamicTypeReadMessage(d DynamicInfo) (m []message.MessageSegment)
- func DynamicTypeShareMessage(d DynamicInfo) (m []message.MessageSegment)
- func DynamicTypeTextMessage(d DynamicInfo) (m []message.MessageSegment)
- func GetAPI(api string) (url string)
- func SendSearchResult(ctx *zero.Ctx, ms []messager)
- func SetAPIDefault(api string, value string)
- func SetGlobalCookie(cookie string)
- func UpdateSubsStatus(sub Subscription) error
- type Bangumi
- type BangumiEPInfo
- type BangumiInfo
- type BangumiLatestInfo
- type Client
- type DynamicInfo
- type LiveRoom
- type LiveRoomInfo
- type Search
- type Subscription
- type User
- type UserInfo
Constants ¶
View Source
const ( SubTypeUp = "up" SubTypeBangumi = "bangumi" SubTypeLive = "live" SubUserAll = "all" )
View Source
const ( SearchTypeBangumi = "media_bangumi" SearchTypeFT = "media_ft" SearchTypeUser = "bili_user" DynamicTypePic = 2 // 图片动态 DynamicTypeText = 4 // 文字动态 DynamicTypeVideo = 8 // 视频动态 DynamicTypeRead = 64 // 专栏动态 LiveStatusClose = 0 // 直播间关闭 LiveStatusOpen = 1 // 直播中 LiveStatusCarousel = 2 // 直播间轮播中 )
一些预定义
Variables ¶
This section is empty.
Functions ¶
func DeleteSubscription ¶
func DeleteSubscription(sub Subscription) error
DeleteSubscription 删除订阅,必须指定SubUsers(=SubUserAll则该订阅全部删除),另外至少需要SubType和BID,或单独指定ID
func DynamicTypePicMessage ¶ added in v0.2.4
func DynamicTypePicMessage(d DynamicInfo) (m []message.MessageSegment)
func DynamicTypeReadMessage ¶ added in v0.2.4
func DynamicTypeReadMessage(d DynamicInfo) (m []message.MessageSegment)
func DynamicTypeShareMessage ¶ added in v0.2.4
func DynamicTypeShareMessage(d DynamicInfo) (m []message.MessageSegment)
func DynamicTypeTextMessage ¶ added in v0.2.4
func DynamicTypeTextMessage(d DynamicInfo) (m []message.MessageSegment)
func SendSearchResult ¶
func SetGlobalCookie ¶ added in v0.3.0
func SetGlobalCookie(cookie string)
SetGlobalCookie 设置全局cookie
func UpdateSubsStatus ¶
func UpdateSubsStatus(sub Subscription) error
Types ¶
type Bangumi ¶
type Bangumi struct {
// contains filtered or unexported fields
}
Bangumi Bilibili番剧相关
func NewBangumi ¶
func NewBangumi() *Bangumi
type BangumiEPInfo ¶
type BangumiInfo ¶
type BangumiInfo struct { MediaID int64 `json:"media_id"` SeasonID int64 `json:"season_id"` Title string `json:"title"` OrgTitle string `json:"org_title"` Areas string `json:"areas"` Description string `json:"desc"` Styles string `json:"styles"` EPSize int `json:"ep_size"` CoverURL string `json:"cover"` // 与哔哩哔哩回包不一致的字段: Score float64 `json:"score"` }
func (BangumiInfo) GenMessage ¶
func (b BangumiInfo) GenMessage(index int) message.Message
func (BangumiInfo) GenText ¶
func (b BangumiInfo) GenText(index int) string
type BangumiLatestInfo ¶
type Client ¶
type Client struct {
*client.HttpClient
}
Client bilibili客户端(请求器)
func (*Client) GetDefaultCookie ¶ added in v0.3.3
func (*Client) NewBangumi ¶ added in v0.3.0
func (*Client) NewLiveRoom ¶ added in v0.3.0
type DynamicInfo ¶
type DynamicInfo struct { ID string `json:"dynamic_id_str"` Type int `json:"type"` Card string `json:"card"` View int64 `json:"view"` Like int64 `json:"like"` Time time.Time `json:"timestamp"` // 与哔哩哔哩回包不一致的附加字段: Uname string `json:"uname"` BVID string `json:"bvid"` }
func (DynamicInfo) VideoCoverURL ¶ added in v0.3.0
func (d DynamicInfo) VideoCoverURL() string
func (DynamicInfo) VideoTitle ¶
func (d DynamicInfo) VideoTitle() string
type LiveRoom ¶
type LiveRoom struct {
// contains filtered or unexported fields
}
LiveRoom 直播相关
func NewLiveRoom ¶
func (*LiveRoom) Info ¶
func (l *LiveRoom) Info() (LiveRoomInfo, error)
type LiveRoomInfo ¶
type LiveRoomInfo struct { ID int64 `json:"room_id"` ShortID int64 `json:"short_id"` Title string `json:"title"` Status int `json:"live_status"` CoverURL string `json:"cover"` Anchor UserInfo `json:"anchor_info"` }
func (LiveRoomInfo) IsOpen ¶
func (l LiveRoomInfo) IsOpen() bool
type Search ¶
type Search struct {
// contains filtered or unexported fields
}
Search Bilibili搜索相关
type Subscription ¶
type Subscription struct { ID int SubUsers string // 格式:若为私人,则直接是ID;若为群订阅,则为 群ID:发起用户ID;多个User用,分隔 SubType string `gorm:"uniqueIndex:idx_sub_item;size:64"` BID int64 `gorm:"uniqueIndex:idx_sub_item"` // UP主ID、番剧ID、直播间ID // 状态相关: BangumiLastIndex string // 番剧:最后一集Index DynamicLastTime time.Time // UP动态:最后一条动态时间戳 LiveStatus bool // 直播间:开播状态 }
func GetSubForPrimary ¶
func GetSubForPrimary(userID int64) []Subscription
GetSubForPrimary 获取私人订阅列表
func (Subscription) GenMessage ¶
func (s Subscription) GenMessage(showUsers bool) message.Message
func (Subscription) GenUsersText ¶
func (s Subscription) GenUsersText() string
func (Subscription) GetFriendsGroups ¶
func (s Subscription) GetFriendsGroups() (friends, groups []int64)
func (*Subscription) TableName ¶
func (s *Subscription) TableName() string
type User ¶
type User struct {
// contains filtered or unexported fields
}
User Bilibili用户(up主)相关
type UserInfo ¶
type UserInfo struct { MID int64 `json:"mid"` Name string `json:"name"` Sex string `json:"sex"` FaceURL string `json:"face"` Sign string `json:"sign"` Level int `json:"level"` Birthday string `json:"birthday"` // 与哔哩哔哩回包不一致的字段: Silence bool `json:"silence"` // 是否被封禁 Fans int64 `json:"fans"` // 粉丝数(仅在搜索结果中提供) LiveRoomID int64 `json:"live_room_id"` }
Click to show internal directories.
Click to hide internal directories.