Fix erroneous async issues
This commit is contained in:
parent
9d819253e0
commit
1f2a2aa73d
@ -22,7 +22,7 @@ module.exports = {
|
|||||||
`&key=${process.env.tenorAPIKey}` +
|
`&key=${process.env.tenorAPIKey}` +
|
||||||
'&limit=1' +
|
'&limit=1' +
|
||||||
`&contentfilter=off`
|
`&contentfilter=off`
|
||||||
).then(res => {
|
).then(async (res) => {
|
||||||
if (process.env.isDev) console.log(res.data.results);
|
if (process.env.isDev) console.log(res.data.results);
|
||||||
if (res.data.results[0] == undefined) {
|
if (res.data.results[0] == undefined) {
|
||||||
message.reply('Sorry I was unable to find a GIF of ' + commandData.args);
|
message.reply('Sorry I was unable to find a GIF of ' + commandData.args);
|
||||||
@ -33,10 +33,10 @@ module.exports = {
|
|||||||
// Handle when the invoking message is a reply to someone else
|
// Handle when the invoking message is a reply to someone else
|
||||||
if (message.reference) {
|
if (message.reference) {
|
||||||
// Fetch the referenced message from the channels' MessageManager
|
// Fetch the referenced message from the channels' MessageManager
|
||||||
await message.channel.messages.fetch(message.reference.messageId).then((refMsg) => {
|
await message.channel.messages.fetch(message.reference.messageId).then(async (refMsg) => {
|
||||||
// Send the reply to the referenced message
|
// Send the reply to the referenced message
|
||||||
await refMsg.reply(commandData.embed_url);
|
await refMsg.reply(commandData.embed_url);
|
||||||
}).catch((e) => {
|
}).catch(async (e) => {
|
||||||
// Failed fetching the message from the channel, fallback to regular send
|
// Failed fetching the message from the channel, fallback to regular send
|
||||||
console.error(e);
|
console.error(e);
|
||||||
await message.reply(commandData.embed_url);
|
await message.reply(commandData.embed_url);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user