From fae06f66d4ebcb1a0630e0742059a74e436499b1 Mon Sep 17 00:00:00 2001 From: EL2020 Date: Tue, 6 Apr 2021 21:04:27 -0400 Subject: [PATCH] added functionality for reacting to in-line replies --- src/commands/utilities/react.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/commands/utilities/react.ts b/src/commands/utilities/react.ts index ceef800..49648aa 100644 --- a/src/commands/utilities/react.ts +++ b/src/commands/utilities/react.ts @@ -10,8 +10,19 @@ export default new Command({ async run($: CommonLibrary): Promise { let target: Message | undefined; let distance = 1; - - if ($.args.length >= 2) { + + // allows reactions by using an in-line reply + if($.message.reference){ + const messageID = $.message.reference.messageID; + try{ + target = await $.channel.messages.fetch(messageID!) + }catch{ + return $.channel.send("Unknown error occurred!") + } + } + + // handles reacts by message id/distance + else if ($.args.length >= 2) { const last = $.args[$.args.length - 1]; // Because this is optional, do not .pop() unless you're sure it's a message link indicator. const URLPattern = /^(?:https:\/\/discord.com\/channels\/(\d{17,19})\/(\d{17,19})\/(\d{17,19}))$/; const copyIDPattern = /^(?:(\d{17,19})-(\d{17,19}))$/;