api/twitter: update no tweet error code

This commit is contained in:
wukko 2024-08-24 16:31:19 +06:00
parent 0d58fad580
commit 37efa035a2
No known key found for this signature in database
GPG key ID: 3E30B3F26C7B4AA2

View file

@ -119,6 +119,10 @@ export default async function({ id, index, toGif, dispatcher }) {
let tweetTypename = tweet?.data?.tweetResult?.result?.__typename;
if (!tweetTypename) {
return { error: "fetch.empty" }
}
if (tweetTypename === "TweetUnavailable") {
const reason = tweet?.data?.tweetResult?.result?.reason;
switch(reason) {
@ -133,10 +137,6 @@ export default async function({ id, index, toGif, dispatcher }) {
}
}
if (!tweetTypename) {
return { error: "link.invalid" }
}
if (!["Tweet", "TweetWithVisibilityResults"].includes(tweetTypename)) {
return { error: "content.post.unavailable" }
}