Skip to content

Commit

Permalink
Create referenceUserId.js
Browse files Browse the repository at this point in the history
  • Loading branch information
baka-aho authored Dec 7, 2023
1 parent edd6d64 commit 760434a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/functions/user/referenceUserId.js
Original file line number Diff line number Diff line change
@@ -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),
}
}

0 comments on commit 760434a

Please sign in to comment.