Download scripts/cmds/appstore.js from sweet2004/bot: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/spaces/sweet2004/bot/resolve/main/scripts/cmds/appstore.js
- Command line
-
hf download hf://spaces/sweet2004/bot/scripts/cmds/appstore.js
-
curl -L -o appstore.js https://huggingface.co/spaces/sweet2004/bot/resolve/main/scripts/cmds/appstore.js
1.84 kB
| const itunes = require("searchitunes"); | |
| const { getStreamFromURL } = global.utils; | |
| module.exports = { | |
| config: { | |
| name: "appstore", | |
| version: "1.1", | |
| author: "NTKhang", | |
| countDown: 5, | |
| role: 0, | |
| shortDescription: { | |
| vi: "Tìm app trên appstore", | |
| en: "Search app on appstore" | |
| }, | |
| longDescription: { | |
| vi: "Tìm app trên appstore", | |
| en: "Search app on appstore" | |
| }, | |
| category: "software", | |
| guide: " {pn}: <keyword>" | |
| + "\n - Example:" | |
| + "\n {pn} PUBG", | |
| envConfig: { | |
| limitResult: 3 | |
| } | |
| }, | |
| langs: { | |
| vi: { | |
| missingKeyword: "Bạn chưa nhập từ khóa", | |
| noResult: "Không tìm thấy kết quả nào cho từ khóa %1" | |
| }, | |
| en: { | |
| missingKeyword: "You haven't entered any keyword", | |
| noResult: "No result found for keyword %1" | |
| } | |
| }, | |
| onStart: async function ({ message, args, commandName, envCommands, getLang }) { | |
| if (!args[0]) | |
| return message.reply(getLang("missingKeyword")); | |
| let results = []; | |
| try { | |
| results = (await itunes({ | |
| entity: "software", | |
| country: "VN", | |
| term: args.join(" "), | |
| limit: envCommands[commandName].limitResult | |
| })).results; | |
| } | |
| catch (err) { | |
| return message.reply(getLang("noResult", args.join(" "))); | |
| } | |
| if (results.length > 0) { | |
| let msg = ""; | |
| const pedningImages = []; | |
| for (const result of results) { | |
| msg += `\n\n- ${result.trackCensoredName} by ${result.artistName}, ${result.formattedPrice} and rated ${"🌟".repeat(result.averageUserRating)} (${result.averageUserRating.toFixed(1)}/5)` | |
| + `\n- ${result.trackViewUrl}`; | |
| pedningImages.push(await getStreamFromURL(result.artworkUrl512 || result.artworkUrl100 || result.artworkUrl60)); | |
| } | |
| message.reply({ | |
| body: msg, | |
| attachment: await Promise.all(pedningImages) | |
| }); | |
| } | |
| else { | |
| message.reply(getLang("noResult", args.join(" "))); | |
| } | |
| } | |
| }; |