random commit
This commit is contained in:
@@ -44,8 +44,8 @@ func (c *Client) GetUserID(login string) (string, error) {
|
||||
return resp.Data.Users[0].ID, nil
|
||||
}
|
||||
|
||||
func getStreamInfo(client *helix.Client, userID string) (*helix.Stream, error) {
|
||||
resp, err := client.GetStreams(&helix.StreamsParams{
|
||||
func (c *Client) GetStreamInfo(userID string) (*helix.Stream, error) {
|
||||
rep, err := c.api.GetStreams(&helix.StreamsParams{
|
||||
UserIDs: []string{userID},
|
||||
})
|
||||
if err != nil {
|
||||
@@ -57,12 +57,12 @@ func getStreamInfo(client *helix.Client, userID string) (*helix.Stream, error) {
|
||||
return &resp.Data.Streams[0], nil
|
||||
}
|
||||
|
||||
func getStreamUptime(client *helix.Client, channel string) (string, error) {
|
||||
userID, err := GetUserID(client, channel)
|
||||
func (c *Client) GetStreamUptime(channel string) (string, error) {
|
||||
userID, err := c.GetUserId(channel)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
stream, err := getStreamInfo(client, userID)
|
||||
stream, err := c.GetStreamInfo(userID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -72,12 +72,12 @@ func getStreamUptime(client *helix.Client, channel string) (string, error) {
|
||||
return uptime.String(), nil
|
||||
}
|
||||
|
||||
func getStreamTitle(client *helix.Client, channel string) (string, error) {
|
||||
userID, err := GetUserID(client, channel)
|
||||
func (c *Client) GetStreamTitle(channel string) (string, error) {
|
||||
userID, err := C. GetUserID(channel)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
resp, err := client.GetChannelInformation(&helix.GetChannelInformationParams{
|
||||
resp, err := c.api.GetChannelInformation(&helix.GetChannelInformationParams{
|
||||
BroadcasterID: userID,
|
||||
})
|
||||
if err != nil {
|
||||
@@ -89,24 +89,24 @@ func getStreamTitle(client *helix.Client, channel string) (string, error) {
|
||||
return resp.Data.Channels[0].Title, nil
|
||||
}
|
||||
|
||||
func setStreamTitle(client *helix.Client, channel, newTitle string) error {
|
||||
userID, err := GetUserID(client, channel)
|
||||
func (c *Client) SetStreamTitle(channel, newTitle string) error {
|
||||
userID, err := c.GetUserID(channel)
|
||||
if err!= nil {
|
||||
return err
|
||||
}
|
||||
_, err = client.EditChannelInformation(&helix.EditChannelInformationParams {
|
||||
_, err = c.api.EditChannelInformation(&helix.EditChannelInformationParams {
|
||||
BroadcasterID: userID,
|
||||
Title: newTitle,
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
func getStreamCategory(client *helix.Client, channel string) (string, error) {
|
||||
userID, err := GetUserID(client, channel)
|
||||
func (c *Client) GetStreamCategory(channel string) (string, error) {
|
||||
userID, err := c.GetUserID(channel)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
resp, err := client.GetChannelInformation(&helix.GetChannelInformationParams{
|
||||
resp, err := c.api.GetChannelInformation(&helix.GetChannelInformationParams{
|
||||
BroadcasterID: userID,
|
||||
})
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user