Skip to content

Commit

Permalink
Switched masto code to hopefully work w/ masto v6
Browse files Browse the repository at this point in the history
  • Loading branch information
BurnerWah committed Dec 27, 2023
1 parent cfd325d commit bbd08ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { login } from 'masto'
import { createRestAPIClient } from 'masto'

export default {
async scheduled(
controller: ScheduledController,
env: Bindings,
ctx: ExecutionContext,
): Promise<void> {
const masto = await login({
const masto = createRestAPIClient({
url: env.BASE_URL,
accessToken: env.ACCESS_TOKEN,
})
Expand All @@ -16,7 +16,7 @@ export default {
const tinyfoxApiData: TinyfoxAPIResponse = await tinyfoxApiRes.json()
const imageUrl = `https://api.tinyfox.dev${tinyfoxApiData.loc}`
const image = await fetch(imageUrl)
const media = await masto.v2.mediaAttachments.create({
const media = await masto.v2.media.create({
file: await image.blob(),
description: 'An image of a red panda',
})
Expand Down

0 comments on commit bbd08ba

Please sign in to comment.