diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f6670a..3ea6a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ ## v3.4.x +#### v3.4.3 (#29) +* [WIP] Fix `.gif` replies to redirect to the original replyee + #### v3.4.2 (#28) * Added `.drink` and aliases @@ -32,4 +35,4 @@ v3.0.4 - Add ability to use multiple aliases v3.0.5 - Add ability to save strains v3.0.6 - Move `.strain` to `/strain` and add Autocomplete v3.0.7 - Add `.spongebob` replies -v3.0.8 - Add ability to open requests by pages \ No newline at end of file +v3.0.8 - Add ability to open requests by pages diff --git a/dot-commands/gif.js b/dot-commands/gif.js index dc2ff98..18861d2 100644 --- a/dot-commands/gif.js +++ b/dot-commands/gif.js @@ -29,7 +29,21 @@ module.exports = { return; }; commandData.embed_url = res.data.results[0].url; - message.reply(commandData.embed_url); + + // 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) => { + // Send the reply to the referenced message + await refMsg.reply(commandData.embed_url); + }).catch((e) => { + // Failed fetching the message from the channel, fallback to regular send + console.error(e); + await message.reply(commandData.embed_url); + }); + } else { + await message.reply(commandData.embed_url); + } }).catch(err => console.error(err)); // tenor.Search.Query(commandData.args, "1").then(res => { // if (res[0] == undefined) { @@ -51,4 +65,4 @@ module.exports = { message.reply(gifData.url); } } -} \ No newline at end of file +} diff --git a/package.json b/package.json index 1251782..1031769 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nodbot", - "version": "3.4.2", + "version": "3.4.3", "description": "Nods and Nod Accessories", "main": "main.js", "dependencies": {