Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async run ({t, author, channel, language}, country, term) {
channel.startTyping()
console.log(term)
const embed = new SwitchbladeEmbed(author)
const response = await gplay.search({term, country, num: 1, lang: language.substring(0, 1)})
if (response.length > 0) {
const app = response[0]
embed
.setColor(0x518FF5)
.setThumbnail('http://' + app.icon)
.setAuthor('Google Play Store', 'https://i.imgur.com/tkTq2bi.png')
.setDescription([
`**[${app.title}](${app.url})**`,
app.summary,
'',
MiscUtils.ratingToStarEmoji(app.score),
app.priceText
].join('\n'))
} else {
embed
.setColor(Constants.ERROR_COLOR)
const fetchApp = (i, cb) => {
if (i >= apps.length) {
return cb();
} else {
gplay.search({
term: apps[i],
num: 1,
}).then((data, err) => {
if (!err && data && data.length > 0) {
results.push({
color: 0x00FF00,
author: {
name: `By ${data[0].developer}`,
},
thumbnail: {
url: data[0].icon ? `http:${data[0].icon}` : "",
},
title: `__${data[0].title}__`,
url: `${data[0].url}`,
description: `A quick summary: \`\`\`\n${data[0].summary}\`\`\``,
footer: {
router.get('/apps/', function (req, res, next) {
if (!req.query.q) {
return next();
}
const opts = Object.assign({term: req.query.q}, req.query);
gplay.search(opts)
.then((apps) => apps.map(cleanUrls(req)))
.then(toList)
.then(res.json.bind(res))
.catch(next);
});