Skip to content

Commit

Permalink
Merge pull request #33 from NID-kt/fix/handle-over-20-reactions
Browse files Browse the repository at this point in the history
Add error handling to messageReaction function
  • Loading branch information
k-taro56 authored Jun 12, 2024
2 parents 60e3e6a + 443c91a commit b9b72a7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ export const messageReaction = ({
message,
queryResultRows,
}: { message: Message; queryResultRows: QueryResultRow[] }) => {
for (const row of queryResultRows) {
message.react(row.value);
}
try {
for (const row of queryResultRows) {
message.react(row.value);
}
} catch {}
};

export const handleMessageCreate =
Expand Down Expand Up @@ -64,6 +66,7 @@ export const handleMessageCreate =
}

if (message.reference?.messageId) {
console.log(message.content);
const reactionAgentEmojis = await sql`
SELECT e.value
FROM emojis e
Expand All @@ -72,6 +75,7 @@ export const handleMessageCreate =
WHERE ra.command = ${message.content}
ORDER BY rae.id ASC;
`;
console.log(reactionAgentEmojis);

if (reactionAgentEmojis.rows.length !== 0) {
const repliedMessage = await message.fetchReference();
Expand Down

0 comments on commit b9b72a7

Please sign in to comment.