Skip to content

Commit

Permalink
fix: 定时任务获取图片
Browse files Browse the repository at this point in the history
  • Loading branch information
XasYer committed Nov 27, 2024
1 parent 3ca964a commit 211d34b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions models/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export async function sendGroupMsg (botId, gid, msg) {
* @returns {string}
*/
export function getHeaderImgUrlByAppid (appid) {
if (!appid) return ''
return `https://steamcdn-a.akamaihd.net/steam/apps/${appid}/header.jpg`
}

Expand All @@ -197,6 +198,7 @@ export function getHeaderImgUrlByAppid (appid) {
* @returns {Promise<Buffer|null|string>}
*/
export async function getImgUrlBuffer (url) {
if (!url) return null
for (let i = 0; i < 3; i++) {
try {
const buffer = await request.get(url, { responseType: 'arraybuffer', baseUrl: '' }).then(res => res.data)
Expand Down

0 comments on commit 211d34b

Please sign in to comment.