catch errors with giphy search
This commit is contained in:
parent
6b764c701b
commit
33f5baa346
@ -7,7 +7,7 @@ module.exports = {
|
|||||||
execute(message, file) {
|
execute(message, file) {
|
||||||
const client = message.client;
|
const client = message.client;
|
||||||
if (!client.gifs.has(file.name)) {
|
if (!client.gifs.has(file.name)) {
|
||||||
giphy.search(file.name, (err, res) => {
|
giphy.search(file.name).then(function (res) {
|
||||||
if (res.data[0] != undefined) {
|
if (res.data[0] != undefined) {
|
||||||
// message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + res.data[0].embed_url).then().catch(console.error);
|
// message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + res.data[0].embed_url).then().catch(console.error);
|
||||||
const gifInfo = {
|
const gifInfo = {
|
||||||
@ -19,8 +19,8 @@ module.exports = {
|
|||||||
} else {
|
} else {
|
||||||
message.channel.send('I was unable to find a gif of ' + file.name);
|
message.channel.send('I was unable to find a gif of ' + file.name);
|
||||||
}
|
}
|
||||||
if (err) console.error(err);
|
})
|
||||||
});
|
.catch(err => console.error(err));
|
||||||
} else {
|
} else {
|
||||||
// message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + client.gifs.get(file.name).embed_url);
|
// message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + client.gifs.get(file.name).embed_url);
|
||||||
const gifInfo = {
|
const gifInfo = {
|
||||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@ -843,9 +843,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"giphy-api": {
|
"giphy-api": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/giphy-api/-/giphy-api-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/giphy-api/-/giphy-api-2.0.2.tgz",
|
||||||
"integrity": "sha512-6FKx6y26W1OqPtEOohvr3MOqCcYWajmz/svrjWm6XW2eP9mHvcQoi4aFg5afCakVF2b7zVllP0aNF45CGHZn+A=="
|
"integrity": "sha512-vZaLQhgMF0mDQSNpqooe4Zqoe2dWGqVYhh7Ar6I41BRtcZtfupr9avT23IIPScKBYfb3qAfiKQRQyKgLi8Lcxw=="
|
||||||
},
|
},
|
||||||
"glob": {
|
"glob": {
|
||||||
"version": "7.1.7",
|
"version": "7.1.7",
|
||||||
@ -1833,9 +1833,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ws": {
|
"ws": {
|
||||||
"version": "7.5.0",
|
"version": "7.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz",
|
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.2.tgz",
|
||||||
"integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw=="
|
"integrity": "sha512-lkF7AWRicoB9mAgjeKbGqVUekLnSNO4VjKVnuPHpQeOxZOErX6BPXwJk70nFslRCEEA8EVW7ZjKwXaP9N+1sKQ=="
|
||||||
},
|
},
|
||||||
"xdg-basedir": {
|
"xdg-basedir": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^12.5.3",
|
"discord.js": "^12.5.3",
|
||||||
"dotenv": "^10.0.0",
|
"dotenv": "^10.0.0",
|
||||||
"giphy-api": "^2.0.1",
|
"giphy-api": "^2.0.2",
|
||||||
"nodemon": "^2.0.9"
|
"nodemon": "^2.0.9"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
Loading…
Reference in New Issue
Block a user