Skip to content

Commit

Permalink
fix: Add error handling to messageReaction function
Browse files Browse the repository at this point in the history
  • Loading branch information
k-taro56 committed Jun 11, 2024
1 parent 60e3e6a commit 443c91a
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 443c91a

Please sign in to comment.