Skip to content

Commit

Permalink
Fix error when user replies to bot embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
TecEash1 committed Apr 29, 2024
1 parent 6d61a67 commit 33226ac
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,20 @@ async function fetchThreadMessages(Gemini_API_KEY, message) {
message.reference.messageId,
);

const startStrings = [
"Response to message by",
"A message has been deleted",
"Reply thread history",
];

if (
originalMessage.author.id !== message.client.user.id ||
(originalMessage.embeds.length > 0 &&
!originalMessage.embeds[0].footer.text.startsWith(
"Response to message by",
))
(!originalMessage.embeds[0].footer ||
!originalMessage.embeds[0].footer.text ||
!startStrings.some((str) =>
originalMessage.embeds[0].footer.text.startsWith(str),
)))
) {
return {
userQuestion: null,
Expand Down

0 comments on commit 33226ac

Please sign in to comment.