Fix erroneous async issues
All checks were successful
NodBot PE Dockerization / build (push) Successful in 7s

This commit is contained in:
Skylar Grant 2025-01-27 16:14:21 -05:00
parent 9d819253e0
commit c330af29fa

View File

@ -22,7 +22,7 @@ module.exports = {
`&key=${process.env.tenorAPIKey}` +
'&limit=1' +
`&contentfilter=off`
).then(res => {
).then(async (res) => {
if (process.env.isDev) console.log(res.data.results);
if (res.data.results[0] == undefined) {
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
if (message.reference) {
// 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
await refMsg.reply(commandData.embed_url);
}).catch((e) => {
}).catch(async (e) => {
// Failed fetching the message from the channel, fallback to regular send
console.error(e);
await message.reply(commandData.embed_url);