diff --git a/packages/client-twitter/src/utils.ts b/packages/client-twitter/src/utils.ts index 2fcbc6a9a7..526e2e12a1 100644 --- a/packages/client-twitter/src/utils.ts +++ b/packages/client-twitter/src/utils.ts @@ -165,16 +165,6 @@ export async function buildConversationThread( return thread; } -export function getMediaType(attachment: Media) { - if (attachment.contentType?.startsWith("video")) { - return "video"; - } else if (attachment.contentType?.startsWith("image")) { - return "image"; - } else { - throw new Error(`Unsupported media type`); - } -} - export async function sendTweet( client: ClientBase, content: Content, @@ -207,14 +197,14 @@ export async function sendTweet( const mediaBuffer = Buffer.from( await response.arrayBuffer() ); - const mediaType = getMediaType(attachment); + const mediaType = attachment.contentType; return { data: mediaBuffer, mediaType }; } else if (fs.existsSync(attachment.url)) { // Handle local file paths const mediaBuffer = await fs.promises.readFile( path.resolve(attachment.url) ); - const mediaType = getMediaType(attachment); + const mediaType = attachment.contentType; return { data: mediaBuffer, mediaType }; } else { throw new Error( diff --git a/packages/plugin-image-generation/src/index.ts b/packages/plugin-image-generation/src/index.ts index fd7f8b5246..9c65469919 100644 --- a/packages/plugin-image-generation/src/index.ts +++ b/packages/plugin-image-generation/src/index.ts @@ -207,7 +207,7 @@ const imageGeneration: Action = { source: "imageGeneration", description: "...", //caption.title, text: "...", //caption.description, - contentType: "image", + contentType: "image/png", }, ], },