-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
540a0c3
commit 46ddcad
Showing
4 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
import moment from 'moment'; | ||
import { getTimeLine, postStatus } from '../Mastodon'; | ||
import { getTimeLine, postStatus, uploadMedia } from '../Mastodon'; | ||
|
||
const DATE_FORMAT = 'YYYY-MM-DD'; | ||
|
||
const postOnWednesday = async (token: string, media_ids: string) => { | ||
if (moment().day() === 3) { | ||
const [lastPost]: any = await getTimeLine(token); | ||
const lastPostDate = lastPost ? moment(lastPost.created_at).format(DATE_FORMAT) : null; | ||
if (!lastPostDate && lastPostDate !== moment().format(DATE_FORMAT)) { | ||
await postStatus(token, media_ids); | ||
return "It's Wednesday My Dudes"; | ||
} else return 'Already Posted My Dude'; | ||
} else return "It's Not Wednesday My Dudes"; | ||
const postOnWednesday = async (token: string, media_ids: string, resources: R2Bucket) => { | ||
const image = await resources.get('wednesday.jpg'); | ||
if (image === null) return; | ||
const response = await uploadMedia(token, await image.blob()); | ||
console.log(response); | ||
|
||
// if (moment().day() === 3) { | ||
// const [lastPost]: any = await getTimeLine(token); | ||
// const lastPostDate = lastPost ? moment(lastPost.created_at).format(DATE_FORMAT) : null; | ||
// if (!lastPostDate && lastPostDate !== moment().format(DATE_FORMAT)) { | ||
// await postStatus(token, media_ids); | ||
// return "It's Wednesday My Dudes"; | ||
// } else return 'Already Posted My Dude'; | ||
// } else return "It's Not Wednesday My Dudes"; | ||
return 'HELLO'; | ||
}; | ||
|
||
export { postOnWednesday }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters