Skip to content

Commit

Permalink
Add nocrop option
Browse files Browse the repository at this point in the history
  • Loading branch information
soruly committed Dec 26, 2023
1 parent 9561680 commit 166fae4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const submitSearch = (imageFileURL, message) =>
`https://api.trace.moe/search?${[
`uid=tg${message.from.id}`,
`url=${encodeURIComponent(imageFileURL)}`,
"cutBorders=1",
messageIsNoCrop(message) ? "" : "cutBorders=1",
].join("&")}`,
TRACE_MOE_KEY ? { headers: { "x-trace-key": TRACE_MOE_KEY } } : {},
).catch((e) => {
Expand Down Expand Up @@ -266,6 +266,11 @@ const messageIsMute = (message) => {
return message.text?.toLowerCase().includes("mute");
};

const messageIsNoCrop = (message) => {
if (message.caption) return message.caption.toLowerCase().includes("nocrop");
return message.text?.toLowerCase().includes("nocrop");
};

const messageIsSkipPreview = (message) => {
if (message.caption) return message.caption.toLowerCase().includes("skip");
return message.text?.toLowerCase().includes("skip");
Expand Down

0 comments on commit 166fae4

Please sign in to comment.