client

package
v0.0.0-...-c497ed5 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	RoomID int
	Uid    int
	Buvid  string
	Cookie string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(roomID int) *Client

NewClient 创建一个新的弹幕 client

func NewClientWithApi

func NewClientWithApi(roomID int, iApi api.IApi) *Client

NewClient 创建一个新的弹幕 client

func (*Client) Handle

func (c *Client) Handle(p packet.Packet)

Handle 处理一个包

func (*Client) OnDanmaku

func (c *Client) OnDanmaku(f func(*message.Danmaku))

OnDanmaku 添加 弹幕事件 的处理器

func (*Client) OnGift

func (c *Client) OnGift(f func(gift *message.Gift))

OnGift 添加 礼物事件 的处理器

func (*Client) OnGuardBuy

func (c *Client) OnGuardBuy(f func(*message.GuardBuy))

OnGuardBuy 添加 开通大航海事件 的处理器

func (*Client) OnLive

func (c *Client) OnLive(f func(*message.Live))

OnLive 添加 开播事件 的处理器

func (*Client) OnSuperChat

func (c *Client) OnSuperChat(f func(*message.SuperChat))

OnSuperChat 添加 醒目留言事件 的处理器

func (*Client) OnUserToast

func (c *Client) OnUserToast(f func(*message.UserToast))

OnUserToast 添加 UserToast 的处理器

func (*Client) RegisterCustomEventHandler

func (c *Client) RegisterCustomEventHandler(cmd string, handler func(s string))

RegisterCustomEventHandler 注册 自定义事件 的处理器

需要提供事件名,可参考 knownCMD

func (*Client) SetCookie

func (c *Client) SetCookie(cookie string)

func (*Client) SetHost

func (c *Client) SetHost(host string)

func (*Client) Start

func (c *Client) Start() error

Start 启动弹幕 Client 初始化并连接 ws、发送心跳包

func (*Client) Stop

func (c *Client) Stop()

Stop 停止弹幕 Client

func (*Client) UseDefaultHost

func (c *Client) UseDefaultHost()

UseDefaultHost 使用默认 host broadcastlv.chat.bilibili.com

Jump to

Keyboard shortcuts

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