package beatleader

import (
	"fmt"
	"log"

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

func GetBLPicture(qqId string) (outputImgName string) {
	blId, err := getBLID(qqId)
	if err != nil {
		return ""
	}
	url := fmt.Sprintf("https://beatleader.xyz/u/%s", blId)
	// outputImgPath := fmt.Sprintf("./tmp/beatleader_%s.png", blId)
	outputImgPath := util.GenTempFilePath(fmt.Sprintf("beatleader_%s.png", blId))
	outputImgName = fmt.Sprintf("beatleader_%s.png", blId)
	if err := util.ScreenshotURL(url, outputImgPath, 1420, 2280, 70, 50, 160, 140, "chartjs"); err != nil {
		log.Printf("ScreenshotURL error: %v\n", err)
		return ""
	}

	return outputImgName
}
