package scoresaber

import (
	"fmt"
	"log"

	"git.lxtend.com/lixiangwuxian/qqbot/util"
)

func GetSSPicture(qqId string) (outputImgName string) {
	ssId, err := GetSSID(qqId)
	if err != nil {
		return ""
	}
	url := fmt.Sprintf("https://scoresaber.com/u/%s", ssId)
	// outputImgPath := fmt.Sprintf("./tmp/scoresaber_%s.png", ssId)
	outputImgPath := util.GenTempFilePath(fmt.Sprintf("scoresaber_%s.png", ssId))
	outputImgName = fmt.Sprintf("scoresaber_%s.png", ssId)
	if err := util.ScreenshotURL(url, outputImgPath, 1420, 2080, 50, 400, 150, 150, ""); err != nil {
		log.Printf("ScreenshotURL error: %v\n", err)
		return ""
	}

	return outputImgName
}
