diff --git a/src/api.ts b/src/api.ts index 5a706c8..2a5bb64 100644 --- a/src/api.ts +++ b/src/api.ts @@ -34,7 +34,7 @@ const processMedia = (media: TweetMedia): APIPhoto | APIVideo | null => { const populateTweetProperties = async ( tweet: TweetPartial, conversation: TimelineBlobPartial, - language: string + language: string | undefined ): Promise => { let apiTweet = {} as APITweet; @@ -116,6 +116,8 @@ const populateTweetProperties = async ( } } + console.log('language', language); + /* If a language is specified, let's try translating it! */ if (typeof language === 'string' && language.length === 2 && language !== tweet.lang) { let translateAPI = await translateTweet( @@ -138,7 +140,7 @@ const populateTweetProperties = async ( export const statusAPI = async ( event: FetchEvent, status: string, - language: string + language: string | undefined ): Promise => { const conversation = await fetchUsingGuest(status, event); const tweet = conversation?.globalObjects?.tweets?.[status] || {}; diff --git a/src/status.ts b/src/status.ts index 220193f..3f71634 100644 --- a/src/status.ts +++ b/src/status.ts @@ -27,7 +27,7 @@ export const handleStatus = async ( ): Promise => { console.log('Direct?', flags?.direct); - let api = await statusAPI(event, status, language || 'en'); + let api = await statusAPI(event, status, language); const tweet = api?.tweet as APITweet; if (flags?.api) {