Skip to content

Commit

Permalink
refactor: remove conditions for allowing to post
Browse files Browse the repository at this point in the history
  • Loading branch information
treipatru committed Aug 13, 2024
1 parent 06ed907 commit 443c7d1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const bree = new Bree({
{
name: 'daily-movie',
timeout: '10s',
cron: '0 15 * * *',
interval: 'at 11:00 am',
},
],

Expand Down
29 changes: 0 additions & 29 deletions src/jobs/daily-movie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { getMovieInfo } from '@/actions/movie/get-movie-info.js';
import { getMoviePoster } from '@/actions/movie/get-movie-poster.js';
import { createPostMedia } from '@/actions/post/create-post-media.js';
import { createPost } from '@/actions/post/create-post.js';
import { getLastPost } from '@/actions/post/get-last-post.js';
import { isAllowedToPost } from '@/actions/post/is-allowed-to-post.js';
import { appLogger } from '@/utils/logger.js';
import process from 'node:process';

Expand All @@ -14,22 +12,6 @@ appLogger.info({
service: 'system',
});

/**
* Get timeline posts and check if the bot is allowed to post.
*/

const lastPost = await getLastPost();
if (
lastPost
&& isAllowedToPost([lastPost]) === false
) {
appLogger.info({
message: 'Not allowed to post right now, exiting.',
service: 'system',
});
process.exit(0);
}

/**
* Discover movies via the Movie Database API and
* pick a movie to post.
Expand All @@ -41,17 +23,6 @@ const bestMovie = getBestMovieByDate(
new Date(),
);

/**
* If we are in development mode, log the movie and exit.
*/
if (process.env.NODE_ENV === 'development') {
appLogger.info({
message: 'In dev mode, aborting post.',
service: 'system',
});
process.exit(0);
}

/**
* Prepare the status and create the media attachment.
*/
Expand Down

0 comments on commit 443c7d1

Please sign in to comment.