mirror of
https://github.com/xaionaro-go/streamctl.git
synced 2025-11-01 11:22:33 +08:00
Clean chat handlers
This commit is contained in:
@@ -16,6 +16,8 @@ type Client interface {
|
||||
}
|
||||
|
||||
type Kick struct {
|
||||
CloseCtx context.Context
|
||||
CloseFn context.CancelFunc
|
||||
Channel *kickcom.ChannelV1
|
||||
Client Client
|
||||
ChatHandler *ChatHandler
|
||||
@@ -44,7 +46,10 @@ func New(
|
||||
return nil, fmt.Errorf("unable to obtain channel info: %w", err)
|
||||
}
|
||||
|
||||
ctx, closeFn := context.WithCancel(ctx)
|
||||
k := &Kick{
|
||||
CloseCtx: ctx,
|
||||
CloseFn: closeFn,
|
||||
Client: client,
|
||||
Channel: channel,
|
||||
SaveCfgFn: saveCfgFn,
|
||||
@@ -60,6 +65,7 @@ func New(
|
||||
}
|
||||
|
||||
func (k *Kick) Close() error {
|
||||
k.CloseFn()
|
||||
return nil
|
||||
}
|
||||
func (k *Kick) SetTitle(ctx context.Context, title string) error {
|
||||
|
||||
@@ -68,9 +68,9 @@ func New(
|
||||
return nil, fmt.Errorf("the function GetOAuthListenPorts returned zero ports")
|
||||
}
|
||||
|
||||
closeCtx, closeFn := context.WithCancel(ctx)
|
||||
ctx, closeFn := context.WithCancel(ctx)
|
||||
t := &Twitch{
|
||||
closeCtx: closeCtx,
|
||||
closeCtx: ctx,
|
||||
closeFn: closeFn,
|
||||
config: cfg,
|
||||
saveCfgFn: saveCfgFn,
|
||||
|
||||
Reference in New Issue
Block a user