2023-10-10 14:28:43 +02:00
|
|
|
package commands
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2022-08-07 21:43:40 +02:00
|
|
|
|
2024-02-20 22:36:33 +01:00
|
|
|
"github.com/lyx0/nourybot/pkg/common"
|
2023-10-10 14:28:43 +02:00
|
|
|
)
|
|
|
|
|
2024-02-28 11:53:39 +01:00
|
|
|
// Preview returns a link to an almost live image of a given twitch stream
|
|
|
|
// if the channel is currently live.
|
2023-10-10 14:28:43 +02:00
|
|
|
func Preview(channel string) string {
|
|
|
|
imageHeight := common.GenerateRandomNumberRange(1040, 1080)
|
|
|
|
imageWidth := common.GenerateRandomNumberRange(1890, 1920)
|
|
|
|
|
|
|
|
reply := fmt.Sprintf("https://static-cdn.jtvnw.net/previews-ttv/live_user_%v-%vx%v.jpg", channel, imageWidth, imageHeight)
|
|
|
|
return reply
|
|
|
|
}
|