Skip to content

Commit 7ac6616

Browse files
committed
correct content type
1 parent 98fbe39 commit 7ac6616

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

packages/client-twitter/src/utils.ts

+2-12
Original file line numberDiff line numberDiff line change
@@ -165,16 +165,6 @@ export async function buildConversationThread(
165165
return thread;
166166
}
167167

168-
export function getMediaType(attachment: Media) {
169-
if (attachment.contentType?.startsWith("video")) {
170-
return "video";
171-
} else if (attachment.contentType?.startsWith("image")) {
172-
return "image";
173-
} else {
174-
throw new Error(`Unsupported media type`);
175-
}
176-
}
177-
178168
export async function sendTweet(
179169
client: ClientBase,
180170
content: Content,
@@ -207,14 +197,14 @@ export async function sendTweet(
207197
const mediaBuffer = Buffer.from(
208198
await response.arrayBuffer()
209199
);
210-
const mediaType = getMediaType(attachment);
200+
const mediaType = attachment.contentType;
211201
return { data: mediaBuffer, mediaType };
212202
} else if (fs.existsSync(attachment.url)) {
213203
// Handle local file paths
214204
const mediaBuffer = await fs.promises.readFile(
215205
path.resolve(attachment.url)
216206
);
217-
const mediaType = getMediaType(attachment);
207+
const mediaType = attachment.contentType;
218208
return { data: mediaBuffer, mediaType };
219209
} else {
220210
throw new Error(

packages/plugin-image-generation/src/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ const imageGeneration: Action = {
207207
source: "imageGeneration",
208208
description: "...", //caption.title,
209209
text: "...", //caption.description,
210-
contentType: "image",
210+
contentType: "image/png",
211211
},
212212
],
213213
},

0 commit comments

Comments
 (0)