catch errors with giphy search

This commit is contained in:
= 2021-07-09 19:00:28 -04:00
parent 6b764c701b
commit 33f5baa346
3 changed files with 10 additions and 10 deletions

View File

@ -7,7 +7,7 @@ module.exports = {
execute(message, file) {
const client = message.client;
if (!client.gifs.has(file.name)) {
giphy.search(file.name, (err, res) => {
giphy.search(file.name).then(function (res) {
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);
const gifInfo = {
@ -19,8 +19,8 @@ module.exports = {
} else {
message.channel.send('I was unable to find a gif of ' + file.name);
}
if (err) console.error(err);
});
})
.catch(err => console.error(err));
} else {
// message.channel.send(file.name + ' requested by ' + message.author.username + '\n' + client.gifs.get(file.name).embed_url);
const gifInfo = {

12
package-lock.json generated
View File

@ -843,9 +843,9 @@
}
},
"giphy-api": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/giphy-api/-/giphy-api-2.0.1.tgz",
"integrity": "sha512-6FKx6y26W1OqPtEOohvr3MOqCcYWajmz/svrjWm6XW2eP9mHvcQoi4aFg5afCakVF2b7zVllP0aNF45CGHZn+A=="
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/giphy-api/-/giphy-api-2.0.2.tgz",
"integrity": "sha512-vZaLQhgMF0mDQSNpqooe4Zqoe2dWGqVYhh7Ar6I41BRtcZtfupr9avT23IIPScKBYfb3qAfiKQRQyKgLi8Lcxw=="
},
"glob": {
"version": "7.1.7",
@ -1833,9 +1833,9 @@
}
},
"ws": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz",
"integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw=="
"version": "7.5.2",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.2.tgz",
"integrity": "sha512-lkF7AWRicoB9mAgjeKbGqVUekLnSNO4VjKVnuPHpQeOxZOErX6BPXwJk70nFslRCEEA8EVW7ZjKwXaP9N+1sKQ=="
},
"xdg-basedir": {
"version": "4.0.0",

View File

@ -6,7 +6,7 @@
"dependencies": {
"discord.js": "^12.5.3",
"dotenv": "^10.0.0",
"giphy-api": "^2.0.1",
"giphy-api": "^2.0.2",
"nodemon": "^2.0.9"
},
"devDependencies": {