Fixed more properly

This commit is contained in:
dangered wolf 2022-07-25 23:58:00 -04:00
parent ff541982b1
commit d27f347bc5
No known key found for this signature in database
GPG key ID: 41E4D37680ED8B58
2 changed files with 5 additions and 3 deletions

View file

@ -34,7 +34,7 @@ const processMedia = (media: TweetMedia): APIPhoto | APIVideo | null => {
const populateTweetProperties = async ( const populateTweetProperties = async (
tweet: TweetPartial, tweet: TweetPartial,
conversation: TimelineBlobPartial, conversation: TimelineBlobPartial,
language: string language: string | undefined
): Promise<APITweet> => { ): Promise<APITweet> => {
let apiTweet = {} as APITweet; 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 a language is specified, let's try translating it! */
if (typeof language === 'string' && language.length === 2 && language !== tweet.lang) { if (typeof language === 'string' && language.length === 2 && language !== tweet.lang) {
let translateAPI = await translateTweet( let translateAPI = await translateTweet(
@ -138,7 +140,7 @@ const populateTweetProperties = async (
export const statusAPI = async ( export const statusAPI = async (
event: FetchEvent, event: FetchEvent,
status: string, status: string,
language: string language: string | undefined
): Promise<APIResponse> => { ): Promise<APIResponse> => {
const conversation = await fetchUsingGuest(status, event); const conversation = await fetchUsingGuest(status, event);
const tweet = conversation?.globalObjects?.tweets?.[status] || {}; const tweet = conversation?.globalObjects?.tweets?.[status] || {};

View file

@ -27,7 +27,7 @@ export const handleStatus = async (
): Promise<StatusResponse> => { ): Promise<StatusResponse> => {
console.log('Direct?', flags?.direct); 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; const tweet = api?.tweet as APITweet;
if (flags?.api) { if (flags?.api) {