huya

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Site = "huya"
	Host = "https://www.huya.com"
)

Variables

View Source
var (
	ErrRoomNotExist = errors.New("房间不存在")
	ErrRoomBanned   = errors.New("涉嫌违规,正在整改中")
)

Functions

func HuyaPath

func HuyaPath(path string) string

func NewExtraKey

func NewExtraKey() *extraKey

func NewKeySet

func NewKeySet() *keySet

Types

type Concern

type Concern struct {
	*StateManager
	// contains filtered or unexported fields
}

func NewConcern

func NewConcern(notify chan<- concern.Notify) *Concern

func (*Concern) Add

func (c *Concern) Add(groupCode int64, id interface{}, ctype concern.Type) (*LiveInfo, error)

func (Concern) CurrentLiveKey

func (k Concern) CurrentLiveKey(keys ...interface{}) string

func (*Concern) FindOrLoadRoom added in v0.0.9

func (c *Concern) FindOrLoadRoom(roomId string) (*LiveInfo, error)

func (*Concern) FindRoom added in v0.0.9

func (c *Concern) FindRoom(roomId string, load bool) (*LiveInfo, error)

func (*Concern) ListWatching added in v0.0.8

func (c *Concern) ListWatching(groupCode int64, ctype concern.Type) ([]*LiveInfo, []concern.Type, error)

func (*Concern) Start

func (c *Concern) Start()

func (*Concern) Stop added in v0.0.19

func (c *Concern) Stop()

type ConcernEvent

type ConcernEvent interface {
	Type() EventType
}

type ConcernLiveNotify

type ConcernLiveNotify struct {
	LiveInfo
	GroupCode int64 `json:"group_code"`
}

func NewConcernLiveNotify

func NewConcernLiveNotify(groupCode int64, l *LiveInfo) *ConcernLiveNotify

func (*ConcernLiveNotify) GetGroupCode added in v0.0.10

func (notify *ConcernLiveNotify) GetGroupCode() int64

func (*ConcernLiveNotify) GetUid added in v0.0.10

func (notify *ConcernLiveNotify) GetUid() interface{}

func (*ConcernLiveNotify) Logger added in v0.0.17

func (notify *ConcernLiveNotify) Logger() *logrus.Entry

func (*ConcernLiveNotify) ToMessage added in v0.0.10

func (notify *ConcernLiveNotify) ToMessage() []message.IMessageElement

func (*ConcernLiveNotify) Type

func (notify *ConcernLiveNotify) Type() concern.Type

type EventType

type EventType int64
const (
	Live EventType = iota
)

type GroupConcernConfig added in v0.0.13

type GroupConcernConfig struct {
	concern_manager.GroupConcernConfig
}

func NewGroupConcernConfig added in v0.0.13

func NewGroupConcernConfig(g *concern_manager.GroupConcernConfig) *GroupConcernConfig

func (*GroupConcernConfig) AtBeforeHook added in v0.0.13

func (g *GroupConcernConfig) AtBeforeHook(notify concern.Notify) (hook *concern_manager.HookResult)

func (*GroupConcernConfig) ShouldSendHook added in v0.0.13

func (g *GroupConcernConfig) ShouldSendHook(notify concern.Notify) (hook *concern_manager.HookResult)

type LiveInfo

type LiveInfo struct {
	RoomId   string `json:"room_id"`
	RoomUrl  string `json:"room_url"`
	Avatar   string `json:"avatar"`
	Name     string `json:"name"`
	RoomName string `json:"room_name"`
	Living   bool   `json:"living"`

	LiveStatusChanged bool `json:"-"`
	LiveTitleChanged  bool `json:"-"`
}

func RoomPage

func RoomPage(roomId string) (*LiveInfo, error)

func (*LiveInfo) GetName added in v0.0.13

func (m *LiveInfo) GetName() string

func (*LiveInfo) Logger added in v0.0.20

func (m *LiveInfo) Logger() *logrus.Entry

func (*LiveInfo) ToString

func (m *LiveInfo) ToString() string

func (*LiveInfo) Type

func (m *LiveInfo) Type() EventType

type StateManager

type StateManager struct {
	*concern_manager.StateManager
	// contains filtered or unexported fields
}

func NewStateManager

func NewStateManager() *StateManager

func (*StateManager) AddLiveInfo

func (c *StateManager) AddLiveInfo(liveInfo *LiveInfo) error

func (StateManager) CurrentLiveKey

func (k StateManager) CurrentLiveKey(keys ...interface{}) string

func (*StateManager) GetLiveInfo

func (c *StateManager) GetLiveInfo(id string) (*LiveInfo, error)

func (*StateManager) Start

func (c *StateManager) Start() error

Jump to

Keyboard shortcuts

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