From 96d35b7ebd150dc42a331104a27455a7f5da77ef Mon Sep 17 00:00:00 2001 From: Leref <12578483+Leref@users.noreply.github.com> Date: Wed, 6 Dec 2023 12:27:16 -0500 Subject: [PATCH 1/4] added loadCommands type. --- src/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/index.d.ts b/src/index.d.ts index dfc1d07b8..a1d2cadc7 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -256,6 +256,7 @@ declare module "aoi.js" { constructor(options: ClientOptions); status(d: StatusOption[]): void; + loadCommands(directory: string, debug?: boolean): void; variables(data: object, table?: string): void; } From 4eaf2aaeb51bbb2c168d378d2d3347eb9e91a03b Mon Sep 17 00:00:00 2001 From: Emi <136156874+aho-emi@users.noreply.github.com> Date: Thu, 7 Dec 2023 05:26:56 +0545 Subject: [PATCH 2/4] Update stringStartsWith.js --- src/functions/util/stringStartsWith.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/functions/util/stringStartsWith.js b/src/functions/util/stringStartsWith.js index 731d43786..ae51b2cc7 100644 --- a/src/functions/util/stringStartsWith.js +++ b/src/functions/util/stringStartsWith.js @@ -2,11 +2,11 @@ module.exports = async d => { const data = d.util.aoiFunc(d); if (data.err) return d.error(data.err); - const [text, check] = data.inside.splits; - - data.result = text.addBrackets().startsWith(check.addBrackets()); + const [text, ...checks] = data.inside.splits; + const result = checks.some(check => text.addBrackets().startsWith(check.addBrackets())); + data.result = result return { - code: d.util.setCode(data) + code: d.util.setCode(data) } -} \ No newline at end of file + } From edd6d640f912f611ac24d7b756504083475b6dd3 Mon Sep 17 00:00:00 2001 From: Emi <136156874+aho-emi@users.noreply.github.com> Date: Thu, 7 Dec 2023 05:29:06 +0545 Subject: [PATCH 3/4] Update stringEndsWith.js --- src/functions/util/stringEndsWith.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/functions/util/stringEndsWith.js b/src/functions/util/stringEndsWith.js index 2b5b9d0a9..9f223e045 100644 --- a/src/functions/util/stringEndsWith.js +++ b/src/functions/util/stringEndsWith.js @@ -2,11 +2,11 @@ module.exports = async d => { const data = d.util.aoiFunc(d); if (data.err) return d.error(data.err); - const [text, check] = data.inside.splits; - - data.result = text.addBrackets().endsWith(check.addBrackets()); + const [text, ...checks] = data.inside.splits; + const result = checks.some(check => text.addBrackets().endsWith(check.addBrackets())); + data.result = result return { - code: d.util.setCode(data) + code: d.util.setCode(data) } -} \ No newline at end of file + } From 760434a27ccbf581405285d975adb3b679f78fcb Mon Sep 17 00:00:00 2001 From: Emi <136156874+aho-emi@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:00:39 +0545 Subject: [PATCH 4/4] Create referenceUserId.js --- src/functions/user/referenceUserId.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/functions/user/referenceUserId.js diff --git a/src/functions/user/referenceUserId.js b/src/functions/user/referenceUserId.js new file mode 100644 index 000000000..4d4d1de4d --- /dev/null +++ b/src/functions/user/referenceUserId.js @@ -0,0 +1,15 @@ +module.exports = async (d) => { + const data = d.util.aoiFunc(d); + const [messageID = d.message.id] = data.inside.splits; + + const message = messageID ? await d.channel.messages.fetch(messageID) : d.message; + if (!message) return d.aoiError.fnError(d, 'message', { inside: data.inside }); + + const id = message.reference?.messageId; + + data.result = id ? (await d.channel.messages.fetch(id))?.author.id : ''; + + return { + code: d.util.setCode(data), + } + }