bilireq

package module
v0.0.0-...-b2a2548 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 23, 2026 License: MIT Imports: 14 Imported by: 0

README

bilireq

自用, 接口尚未稳定, 随时可能变动

使用浏览器代替用户发起请求, 实现自动化, 无需实现cookie刷新机制

UserScript

// ==UserScript==
// @name        well-jsnet
// @namespace   well-jsnet.remoon.net
// @match       https://message.bilibili.com/
// @grant       none
// @version     1.0
// @author      -
// @run-at      document-start
// @description 12/05/2025, 10:07:53
// ==/UserScript==

void (async function main() {
  console.log("加载程序")
  // const SaltLink = await import("http://127.0.0.1:4173/index.js")
  const SaltLink = await import("https://unpkg.com/well-net/index.js")
  console.log("连接开始")
  const net = await SaltLink.connect({
    Key: "CH7G4Uu+0hDnIVzcc0aN+iPwgKG/uGZbL9gJvZnSg3k=",
    Peer: "ws://127.0.0.1:7799/api/whip#xMjphMUyLIGExyJluSslD9tjaIcF9QS6ADyI8DOTzyg=",
    // LogLevel: "debug",
  })
  const srv = await net.listen("0.0.0.0:80", {
    async fetch(req) {
      const link = new URL(req.url)
      if (link.pathname === "/live-cookie") {
        const ids = await Promise.all(
          ["DedeUserID", "buvid3"].map((k) =>
            cookieStore.get(k).then((v) => v.value),
          ),
        )
        return new Response(JSON.stringify(ids))
      }
      const jct = await cookieStore.get("bili_jct")
      if (link.pathname === "/csrf2") {
        const uid = await cookieStore.get("DedeUserID").then((v) => v.value)
        const devId = localStorage.getItem("im_deviceid_" + uid)
        return new Response(JSON.stringify([jct.value, uid, devId]))
      }
      return new Response(jct.value)
    },
  })
  await net.http_proxy("0.0.0.0:1080", {})
  console.log("代理启动成功")
  console.log("连接成功")
  setTimeout(
    () => {
      location.reload()
    },
    24 * 60 * 60 * 1e3,
  )
})()

Todo

  • 会话列表接口
  • 会话消息接口
  • 发送消息接口

Documentation

Index

Constants

View Source
const BilibiliTimeEmpty = "0000-00-00 00:00:00"
View Source
const BilibiliTimeLayout = "2006-01-02 15:04:05"
View Source
const LiveFeedPageSize = 20

Variables

View Source
var (
	ErrBilibili   = errors.New("bilibili resp data error")
	ErrUnkownCode = fmt.Errorf("%w. unkown code error", ErrBilibili)
	ErrNotLogin   = fmt.Errorf("%w. user is not login", ErrBilibili)
	ErrRespFormat = fmt.Errorf("%w. resp unmarshal json failed", ErrBilibili)
)
View Source
var BilibiliTimeLoc = try.To1(time.LoadLocation("Asia/Shanghai"))

Functions

This section is empty.

Types

type ActType

type ActType int
const (
	ActSub ActType = 1 + iota
	ActUnsub
	ActHiddenSub
	ActUnhiddenSub
	ActBlock
	ActUnblock
	ActRemoveFollower
)

type AttentionList

type AttentionList struct {
	List []int64 `json:"list,omitempty"`
}

type BilibiliTime

type BilibiliTime time.Time

func (*BilibiliTime) UnmarshalJSON

func (c *BilibiliTime) UnmarshalJSON(b []byte) error

type Card

type Card struct {
	Card string    `json:"card,omitempty"`
	Desc *CardDesc `json:"desc,omitempty"`
}

type CardDesc

type CardDesc struct {
	DynamicId    int64                `json:"dynamic_id,omitempty"`
	Type         DynamicDescType      `json:"type,omitempty"`
	Timestamp    int64                `json:"timestamp,omitempty"`
	DynamicIdStr string               `json:"dynamic_id_str,omitempty"`
	UserProfile  *CardDescUserProfile `json:"user_profile,omitempty"`
	BVID         *string              `json:"bvid,omitempty"`
}

type CardDescUserProfile

type CardDescUserProfile struct {
	Info *CardDescUserProfileInfo `json:"info,omitempty"`
}

type CardDescUserProfileInfo

type CardDescUserProfileInfo struct {
	Uid   int64  `json:"uid,omitempty"`
	Uname string `json:"uname,omitempty"`
	Face  string `json:"face,omitempty"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(host string) (_ *Client)

func (*Client) AttentionList

func (api *Client) AttentionList() (resp Response[AttentionList], err error)

func (*Client) DynamicHistory

func (api *Client) DynamicHistory(offset string) (resp Response[DynamicHistoryList], err error)

func (*Client) DynamicHistoryGenerator

func (api *Client) DynamicHistoryGenerator(offset string) *DynamicHistory

func (*Client) DynamicNew

func (api *Client) DynamicNew() (resp Response[DynamicNewList], err error)

func (*Client) LiveFeedAll

func (api *Client) LiveFeedAll() (feeds []LiveInfo, err error)

func (*Client) LiveFeedList

func (api *Client) LiveFeedList(page int) (resp Response[LiveFeedList], err error)

func (*Client) LiveRoomInfo

func (api *Client) LiveRoomInfo(id string) (resp Response[LiveRoomInfo], err error)

func (*Client) MsgSend

func (api *Client) MsgSend(params MsgSendParams) (resp Response[json.RawMessage], err error)

说是需要 wbi 签名, 但其实不需要, 只需要 csrf 就够了

func (*Client) MsgSend2User

func (api *Client) MsgSend2User(uid int64, msg string) (resp Response[json.RawMessage], err error)

func (*Client) MsgUnread

func (api *Client) MsgUnread(params MsgUnreadParams) (resp Response[MsgUnread], err error)

func (*Client) Msgs

func (api *Client) Msgs(params MsgsGetParams) (resp Response[SessionMsgs], err error)

func (*Client) RelationModify

func (api *Client) RelationModify(mid string, act ActType) (resp Response[any], err error)

func (*Client) Session

func (api *Client) Session(params SessionGetParams) (resp Response[MsgSession], err error)

func (*Client) Sessions

func (api *Client) Sessions(params SessionsGetParams) (resp Response[SessionList], err error)

func (*Client) SetDebug

func (api *Client) SetDebug(v bool)

func (*Client) SpaceInfo

func (api *Client) SpaceInfo(uid string) (resp Response[SpaceInfo], err error)

func (*Client) UnreadMsgs

func (api *Client) UnreadMsgs(m MsgSession) ([]PrivateMsgItem, error)

func (*Client) UserInfo

func (api *Client) UserInfo() (resp Response[UserInfo], err error)

func (*Client) YieldMsgs

func (api *Client) YieldMsgs(params MsgsGetParams) func(yield func(uint64, *SessionMsgs) bool)

func (*Client) YieldSessions

func (api *Client) YieldSessions(params SessionsGetParams) func(func(SessionList) bool)

func (*Client) YieldUnreadMsgs

func (api *Client) YieldUnreadMsgs(d time.Duration) func(func(MsgSession, []PrivateMsgItem) bool)

type ClientInfo

type ClientInfo struct {
	BuildVersion int64  `url:"build,omitempty"`    // 客户端内部版本号
	MobiApp      string `url:"mobi_app,omitempty"` // 平台标识. 可为 web 等
}

type DynamicDescType

type DynamicDescType int32
const (
	DynamicDescType_DynamicDescTypeUnknown DynamicDescType = 0
	DynamicDescType_WithOrigin             DynamicDescType = 1
	DynamicDescType_WithImage              DynamicDescType = 2
	DynamicDescType_TextOnly               DynamicDescType = 4
	DynamicDescType_WithVideo              DynamicDescType = 8
	DynamicDescType_WithPost               DynamicDescType = 64
	DynamicDescType_WithMusic              DynamicDescType = 256
	DynamicDescType_WithAnime              DynamicDescType = 512
	// 该内容已经不见了哦
	DynamicDescType_WithMiss DynamicDescType = 1024
	// 评分、头像挂关注件,这种动态下面有一个小卡片的
	DynamicDescType_WithSketch DynamicDescType = 2048
	DynamicDescType_WithMovie  DynamicDescType = 4098
	// 电视剧、综艺
	DynamicDescType_WithDrama DynamicDescType = 4099
	// 4100去哪了捏
	DynamicDescType_WithDocumentary DynamicDescType = 4101
	DynamicDescType_WithLive        DynamicDescType = 4200
	// XXX的收藏夹,收藏夹居然也可以发动态?
	DynamicDescType_WithMylist DynamicDescType = 4300
	// (付费?)课程
	DynamicDescType_WithCourse DynamicDescType = 4302
	DynamicDescType_WithLiveV2 DynamicDescType = 4308
)

type DynamicHistory

type DynamicHistory struct {
	// contains filtered or unexported fields
}

func (*DynamicHistory) Error

func (d *DynamicHistory) Error() error

func (*DynamicHistory) Next

func (d *DynamicHistory) Next() (hasNext bool)

func (*DynamicHistory) Value

func (d *DynamicHistory) Value() []*Card

type DynamicHistoryList

type DynamicHistoryList struct {
	Cards      []*Card `json:"cards,omitempty"`
	HasMore    int32   `json:"has_more,omitempty"`
	NextOffset int64   `json:"next_offset,omitempty"`
}

type DynamicNewList

type DynamicNewList struct {
	NewNum        int32   `json:"new_num,omitempty"`
	ExistGap      int32   `json:"exist_gap,omitempty"`
	UpdateNum     int32   `json:"update_num,omitempty"`
	OpenRcmd      int32   `json:"open_rcmd,omitempty"`
	Cards         []*Card `json:"cards,omitempty"`
	MaxDynamicId  int64   `json:"max_dynamic_id,omitempty"`
	HistoryOffset int64   `json:"history_offset,omitempty"`
}

type GroupType

type GroupType int64 // 粉丝团类型
const (
	GroupType0 GroupType = 0 // 应援团
	GroupType2 GroupType = 2 // 官方群(如:ID 为 10 的粉丝团)
)

type IntBool

type IntBool int64
const (
	IntTrue  IntBool = 1
	IntFalse IntBool = 0
)

type LiveFeedList

type LiveFeedList = Page[LiveInfo]

type LiveInfo

type LiveInfo struct {
	Cover        string `json:"cover,omitempty"`
	Face         string `json:"face,omitempty"`
	Uname        string `json:"uname,omitempty"`
	Title        string `json:"title,omitempty"`
	Roomid       int64  `json:"roomid,omitempty"`
	Pic          string `json:"pic,omitempty"`
	Online       int64  `json:"online,omitempty"`
	Link         string `json:"link,omitempty"`
	Uid          int64  `json:"uid,omitempty"`
	ParentAreaId int64  `json:"parent_area_id,omitempty"`
	AreaId       int64  `json:"area_id,omitempty"`
}

type LiveRoomInfo

type LiveRoomInfo struct {
	LiveTime   BilibiliTime `json:"live_time"`
	LiveStatus LiveStatus   `json:"live_status"`
}

type LiveStatus

type LiveStatus int
const (
	LiveOff       LiveStatus = 0 //未开播
	LiveOnline    LiveStatus = 1 //直播中
	LiveVideoLoop LiveStatus = 2 //视频轮播
)

type MessageText

type MessageText struct {
	Content string `json:"content"`
}

func (*MessageText) String

func (m *MessageText) String() string

type MsgSendParams

type MsgSendParams struct {
	Sender       string            `url:"msg[sender_uid]"`                 //
	Receiver     int64             `url:"msg[receiver_id]"`                //
	ReceiverType SessionTalkerType `url:"msg[receiver_type]"`              // 接收者类型
	MsgType      MsgSendType       `url:"msg[msg_type]"`                   // 消息类型*. 此接口仅支持传入 1、2 或 5
	MsgStatus    int64             `url:"msg[msg_status],omitempty"`       //
	FaceVersion  int64             `url:"msg[new_face_version],omitempty"` //
	Timestamp    int64             `url:"msg[timestamp]"`                  //
	ContentStr   string            `url:"msg[content]"`                    //
	Content      any               `url:"-"`                               //
	CSRF         string            `url:"csrf"`                            //
	DeviceID     string            `url:"msg[dev_id]"`                     //
	ClientInfo
}

type MsgSendType

type MsgSendType int64

私信消息类型

const (
	MsgSendTypeText   MsgSendType = 1 // 文字消息
	MsgSendTypeImg    MsgSendType = 2 // 图片消息
	MsgSendTypeRevoke MsgSendType = 5 // 撤回消息
)

type MsgSession

type MsgSession struct {
	Talker
	AtSeqNo           uint64             `json:"at_seqno"`             // 最近一次未读at自己的消息的序列号. 在粉丝团会话中有效,若没有未读的 at 自己的消息则为 0
	TopTs             int64              `json:"top_ts"`               // 置顶该会话的时间. 微秒级时间戳;若未置顶该会话则为 0;用于判断是否置顶了会话
	GroupName         string             `json:"group_name"`           // 粉丝团名称. 在粉丝团会话中有效,其他会话中为空字符串
	GroupCover        string             `json:"group_cover"`          // 粉丝团头像. 在粉丝团会话中有效,其他会话中为空字符串
	IsFollow          int64              `json:"is_follow"`            // 是否关注了对方. 在用户会话中有效,系统会话中为 1, 其他会话中为 0
	IsDnd             int64              `json:"is_dnd"`               // 是否对会话设置了免打扰
	AckSeqNo          uint64             `json:"ack_seqno"`            // 最近一次已读的消息序列号. 用于快速跳转到首条未读的消息
	AckTs             int64              `json:"ack_ts"`               // 最近一次已读时间
	SessionTs         int64              `json:"session_ts"`           // 会话时间
	UnreadCount       int64              `json:"unread_count"`         // 未读消息数
	LastMsg           *PrivateMsgItem    `json:"last_msg"`             // 最近的一条消息
	GroupType         GroupType          `json:"group_type"`           // 粉丝团类型. 在粉丝团时有效
	CanFold           int64              `json:"can_fold"`             // 会话是否可被折叠入未关注人消息. 在用户会话中有效
	Status            int64              `json:"status"`               // 会话状态. 详细信息有待补充
	MaxSeqNo          uint64             `json:"max_seqno"`            // 最近一条消息的序列号
	NewPushMsg        int64              `json:"new_push_msg"`         // 是否有新推送的消息
	Setting           int64              `json:"setting"`              // 推送设置. 0:接收推送; 1:不接收推送; 2:(?);
	IsGuardian        int64              `json:"is_guardian"`          // 自己是否为对方的骑士(?). 在用户会话中有效. 0:否; 2:是(?);
	IsIntercept       int64              `json:"is_intercept"`         // 会话是否被拦截
	IsTrust           int64              `json:"is_trust"`             // 是否信任此会话. 若为 1,则表示此会话之前被拦截过,但用户选择信任本会话
	SystemMsgType     SystemMsgType      `json:"system_msg_type"`      // 系统会话类型
	AccountInfo       *SystemAccountInfo `json:"account_info"`         // 会话信息. 仅在系统会话中出现
	BizMsgUnreadCount int64              `json:"biz_msg_unread_count"` // 未读通知消息数
}

会话对象

func (*MsgSession) NoNew

func (m *MsgSession) NoNew() bool

type MsgSource

type MsgSource int64

消息来源列表

const (
	MsgSourceUnkown       MsgSource = iota // 未知来源
	MsgSourceIOS                           // iOS
	MsgSourceAndroid                       // Android
	MsgSourceH5                            // H5
	MsgSourcePC                            // PC客户端
	MsgSourcePush                          // 官方推送消息. 包括:官方向大多数用户自动发送的私信(如:UP主小助手的推广)等
	MsgSourceNotification                  // 推送/通知消息. 包括:特别关注时稿件的自动推送、因成为契约者而自动发送的私信、包月充电回馈私信、官方发送的特定于自己的消息(如:UP主小助手的稿件审核状态通知)等
	MsgSourceWeb                           // Web
	MsgSourceAutoFollow                    // 自动回复 - 被关注回复. B站前端会显示“此条消息为自动回复”
	MsgSourceAutoReply                     // 自动回复 - 收到消息回复
	MsgSourceAutoKeywords                  // 自动回复 - 关键词回复
	MsgSourceAutoGuard                     // 自动回复 - 大航海上船回复
	MsgSourceAutoUpVideo                   // 自动推送 - UP 主赠言. 在以前稿件推送消息与其附带的 UP 主赠言是 2 条不同的私信(其中 UP 主赠言的消息来源代码为 12),现在 UP 主赠言已并入为稿件自动推送消息的一部分(attach_msg)
	MsgSourceSystemFans                    // 粉丝团系统提示. 如:粉丝团中的提示信息“欢迎xxx入群”

	MsgSourceSystem           // 系统. 目前仅在 msg_type 为 51 时使用该代码
	MsgSourceAutoFollowMutual // 互相关注. 互相关注时自动发送的私信“我们已互相关注,开始聊天吧~”
	MsgSourceSystemTip        // 系统提示. 目前仅在 msg_type 为 18 时使用该代码,如:“对方主动回复或关注你前,最多发送1条消息”
	MsgSourceAI               // AI. 如:给搜索AI助手测试版发送私信时对方的自动回复
)

type MsgStatus

type MsgStatus int64

消息状态

const (
	MsgStatusOK             MsgStatus = iota // 正常
	MsgStatusRevoke                          // 被撤回(接口仍能返回被撤回的私信内容)
	MsgStatusRevokeBySystem                  // 被系统撤回(如:消息被举报;私信将不会显示在前端,B站接口也不会返回被系统撤回的私信的信息)

	MsgStatusImgExipred MsgStatus = 50 //
)

type MsgUnread

type MsgUnread struct {
	Unfollow     int64 `json:"unfollow_unread"`   // 未读未关注用户私信数
	Follow       int64 `json:"follow_unread"`     // 未读已关注用户私信数
	UnfollowPush int64 `json:"unfollow_push_msg"` // 未读未关注用户推送消息数
	MsgUnreadDustbin
	MsgUnreadBiz
	Custom int64 `json:"custom_unread"` // 未读客服消息数
}

type MsgUnreadBiz

type MsgUnreadBiz struct {
	Unfollow int64 `json:"biz_msg_unfollow_unread"` // 未读未关注用户通知数
	Follow   int64 `json:"biz_msg_follow_unread"`   // 未读已关注用户通知数
}

type MsgUnreadDustbin

type MsgUnreadDustbin struct {
	PushMsg int64 `json:"dustbin_push_msg"` // 未读被拦截的推送消息数
	Unread  int64 `json:"dustbin_unread"`   // 未读被拦截的私信数
}

type MsgUnreadParams

type MsgUnreadParams struct {
	Type             MsgUnreadType `url:"unread_type,omitempty"`        // 未读类型
	ShowUnfollowList IntBool       `url:"show_unfollow_list,omitempty"` // 是否返回未关注人推送消息数
	ShowDustbin      IntBool       `url:"show_dustbin,omitempty"`       // 是否返回未关注人推送消息数
}

type MsgUnreadType

type MsgUnreadType int64
const (
	MsgUnreadTypeAll          MsgUnreadType = 0 // 所有
	MsgUnreadTypeFollowOnly   MsgUnreadType = 1 // 仅已关注
	MsgUnreadTypeUnfollowOnly MsgUnreadType = 2 // 仅未关注
	MsgUnreadTypeDustbinOnly  MsgUnreadType = 3 // 仅被拦截 (须同时设置参数 show_dustbin=1)
)

type MsgsGetParams

type MsgsGetParams struct {
	Talker
	Size           int64  `url:"size,omitempty"`             // 返回消息数量. 默认为 0,最大为 2000. 当本参数为 0 或不存在时,只返回系统提示
	EndSeqNo       uint64 `url:"end_seqno,omitempty"`        // 最新的序列号开始. 提供本参数时返回以本序列号结束(不包括本序列号)的消息
	BeginSeqNo     uint64 `url:"begin_seqno,omitempty"`      // 到最老的序列号结束. 提供本参数时返回以本序列号开始(不包括本序列号)的消息
	SenderDeviceID int64  `url:"sender_device_id,omitempty"` // 发送者设备. 默认为 1
	ClientInfo
}

type Page

type Page[T any] struct {
	Results  int32  `json:"results,omitempty"`
	Page     string `json:"page,omitempty"`
	Pagesize string `json:"pagesize,omitempty"`
	List     []T    `json:"list,omitempty"`
}

type PrivateMsgItem

type PrivateMsgItem struct {
	Sender         int64             `json:"sender_uid"`       // 发送者mid
	ReceiverType   SessionTalkerType `json:"receiver_type"`    // 接收者类型
	Receiver       int64             `json:"receiver_id"`      // 接收者id. receiver_type 为 1 时表示用户 mid,为 2 时表示粉丝团 id
	MsgType        MsgSendType       `json:"msg_type"`         // 消息类型
	Content        string            `json:"content"`          // 消息内容. 私信内容对象经过 JSON 序列化后的文本
	MsgSeqNo       uint64            `json:"msg_seqno"`        // 消息序列号. 按照时间顺序从小到大
	Timestamp      int64             `json:"timestamp"`        // 消息发送时间. 秒级时间戳
	AtUIDs         []int64           `json:"at_uids"`          // at的成员mid. 在粉丝团时有效;此项为 null 或 [0] 均表示没有 at 成员
	MsgKey         big.Int           `json:"msg_key"`          // 消息唯一id. 部分库在解析JSON对象中的大数时存在数值的精度丢失问题,因此在处理此字段时可能会出现问题,建议使用修复了这一问题的库(如将大数转换成文本)
	MsgStatus      MsgStatus         `json:"msg_status"`       // 消息状态
	SysCancel      bool              `json:"sys_cancel"`       // 是否为系统撤回
	NotifyCode     string            `json:"notify_code"`      // 通知代码. 发送通知时使用,以下划线 _ 分割,第 1 项表示主业务 id,第 2 项表示子业务 id;若这条私信非通知则为空文本;详细信息有待补充
	NewFaceVersion int64             `json:"new_face_version"` // 表情包版本. 为 0 或无此项表示旧版表情包,此时 B 站会自动转换成新版表情包,例如 [doge] -> [tv_doge];1 为新版
	MsgSource      MsgSource         `json:"msg_source"`       // 消息来源
}

私信主体对象

func (*PrivateMsgItem) Message

func (msg *PrivateMsgItem) Message() (fmt.Stringer, error)

type Response

type Response[T any] struct {
	Code    int    `json:"code"`
	Data    T      `json:"data"`
	Message string `json:"message"`
	TTL     int    `json:"ttl"`
}

type SessionGetParams

type SessionGetParams struct {
	Talker
	ClientInfo
}

type SessionList

type SessionList struct {
	List                []MsgSession    `json:"session_list"`          // 会话列表
	HasMore             IntBool         `json:"has_more"`              // 是否有更多会话
	AntiDistrubCleaning bool            `json:"anti_distrub_cleaning"` // 是否开启了“一键防骚扰”功能
	IsAddressListEmpty  int64           `json:"is_address_list_empty"` // 作用尚不明确
	SystemMsg           json.RawMessage `json:"system_msg"`            // 系统会话列表
	ShowLevel           bool            `json:"show_level"`            // 是否在会话列表中显示用户等级. 目前恒为 true
}

type SessionMsgs

type SessionMsgs struct {
	Messages   []PrivateMsgItem `json:"messages"`
	HasMore    int64            `json:"has_more"`
	MinSeqNo   uint64           `json:"min_seqno"`
	MaxSeqNo   uint64           `json:"max_seqno"`
	EmojiInfos json.RawMessage  `json:"e_infos"`
}

type SessionTalkerType

type SessionTalkerType int64 // 聊天对象的类型
const (
	SessionTalkerTypeUser SessionTalkerType = 1 // 用户
	SessionTalkerTypeFans SessionTalkerType = 2 // 粉丝团
)

type SessionType

type SessionType int64

会话类型

const (
	SessionTypeUser      SessionType // 用户与系统
	SessionTypeUnfollow              // 未关注人
	SessionTypeFans                  // 粉丝团
	SessionTypeAll                   // 所有
	SessionTypeBiz                   // 被拦截
	SessionType6                     // 花火商单
	SessionTypeAllSystem             // 所有系统消息
	SessionType8                     // 陌生人(与 “未关注人” 不同,不包含官方消息)
	SessionType9                     // 关注的人与系统
)

type SessionsGetParams

type SessionsGetParams struct {
	SessionType  SessionType `url:"session_type"`            // 会话类型
	GroupFold    IntBool     `url:"group_fold,omitempty"`    // 是否折叠粉丝团消息
	UnfollowFold IntBool     `url:"unfollow_fold,omitempty"` // 是否折叠未关注人消息
	SortRule     int64       `url:"sort_rule,omitempty"`     // 仅当 session_type 不为 4、7 时有效. 1、2:按会话时间逆向排序; 3:按已读时间逆向排序; 其他:用户与系统按会话时间逆向排序,粉丝团按加入时间正向排序
	BeginTs      int64       `url:"begin_ts,omitempty"`      // 起始时间. 微秒级时间戳
	EndTs        int64       `url:"end_ts,omitempty"`        // 终止时间. 微秒级时间戳
	Size         int64       `url:"size,omitempty"`          // 返回的会话数. 默认为 20,最大为 100
	ClientInfo
}

type SpaceInfo

type SpaceInfo struct {
	Mid   int64  `json:"mid,omitempty"`
	Name  string `json:"name,omitempty"`
	Level int32  `json:"level,omitempty"`
}

type SystemAccountInfo

type SystemAccountInfo struct {
	Name string `json:"name"`    // 会话名称
	Pic  string `json:"pic_url"` // 会话头像
}

type SystemMsgType

type SystemMsgType int64 // 系统会话类型
const (
	SystemMsgType0    SystemMsgType = iota // 非系统会话
	SystemMsgTypeLive                      // 主播小助手

	SystemMsgTypeNotify // 系统通知(?)

	SystemMsgTypeUp   // UP主小助手
	SystemMsgTypeKefu // 客服消息
	SystemMsgTypePay  // 支付小助手
)

type Talker

type Talker struct {
	ID          int64             `json:"talker_id" url:"talker_id"`       // 聊天对象的id. session_type 为 1 时表示用户 mid,为 2 时表示粉丝团 id
	SessionType SessionTalkerType `json:"session_type" url:"session_type"` // 聊天对象的类型
}

func TalkerUser

func TalkerUser(uid int64) Talker

type UserInfo

type UserInfo struct {
	IsLogin bool   `json:"isLogin,omitempty"`
	Mid     int64  `json:"mid,omitempty"`
	Uname   string `json:"uname,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL