Skip to content

Commit 545c6d0

Browse files
committed
feat(mastodon-bot-yearprogress): Replace megalodon with masto
1 parent 1c20164 commit 545c6d0

File tree

3 files changed

+205
-79
lines changed

3 files changed

+205
-79
lines changed

packages/mastodon-bot-yearprogress/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
},
66
"dependencies": {
77
"commander": "14.0.1",
8-
"megalodon": "10.1.3"
8+
"masto": "7.2.0"
99
},
1010
"description": "Toots year's progress every few days to Mastodon.",
1111
"devDependencies": {

packages/mastodon-bot-yearprogress/src/YearProgressClient.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import generator from 'megalodon';
1+
import {createRestAPIClient} from 'masto';
22
import {Config} from './Config.js';
33

44
enum ConfigKeys {
@@ -123,7 +123,14 @@ export class YearProgressClient {
123123
}
124124

125125
private async toot(text: string): Promise<void> {
126-
const client = generator('mastodon', this.baseURL, this.accessToken);
127-
await client.postStatus(text, {spoiler_text: `Year's progress`});
126+
const masto = createRestAPIClient({
127+
accessToken: this.accessToken,
128+
url: this.baseURL,
129+
});
130+
131+
await masto.v1.statuses.create({
132+
spoilerText: `Year's progress`,
133+
status: text,
134+
});
128135
}
129136
}

0 commit comments

Comments
 (0)