Added message for when daily search limit goes over quota
This commit is contained in:
parent
d71fcb5ea3
commit
f2d5066d2c
1 changed files with 1 additions and 0 deletions
|
@ -9,6 +9,7 @@ exports.run = async (message, args) => {
|
||||||
const embeds = [];
|
const embeds = [];
|
||||||
const request = await fetch(`https://www.googleapis.com/customsearch/v1?key=${process.env.GOOGLE}&cx=${process.env.CSE}&safe=active&searchType=image&q=${encodeURIComponent(args.join(" "))}`);
|
const request = await fetch(`https://www.googleapis.com/customsearch/v1?key=${process.env.GOOGLE}&cx=${process.env.CSE}&safe=active&searchType=image&q=${encodeURIComponent(args.join(" "))}`);
|
||||||
const images = await request.json();
|
const images = await request.json();
|
||||||
|
if (images.error && images.error.code === 403) return `${message.author.mention}, the daily search quota has been exceeded. Check back later.`;
|
||||||
if (!images.items) return `${message.author.mention}, I couldn't find any results!`;
|
if (!images.items) return `${message.author.mention}, I couldn't find any results!`;
|
||||||
for (const [i, value] of images.items.entries()) {
|
for (const [i, value] of images.items.entries()) {
|
||||||
embeds.push({
|
embeds.push({
|
||||||
|
|
Loading…
Reference in a new issue