This Telegram bot polls a website for new Shaman King Flowers episodes.
Every time a new episode is available, it sends a message with the information regarding the episode and its url.
This bot only polls the website, I don't have any responsibility regarding the website or the upload of the episodes.
To run the bot, you need:
-
Create a Telegram bot as explained in the official documentation.
-
Save the token provided by the @BotFather
- Add bot to the Channel
- Get the list of updates for your BOT
https://api.telegram.org/bot<YourBOTToken>/getUpdates
- Get the chatId value from the response
{"update_id":8393,"message":{"message_id":3,"from":{"id":7474,"first_name":"AAA"},"chat":{"id":<CHAT_ID>,"title":""},"date":25497,"new_chat_participant":{"id":71,"first_name":"NAME","username":"YOUR_BOT_NAME"}}}
On the root of the project, create a .env with
BOT_TOKEN=<YOUR TOKEN>
CHAT_ID=<YOUR CHAT ID>
POSTGRES_PASSWORD=root
POSTGRES_USER=root
POSTGRES_DB=shaman_king
POSTGRES_HOST=localhost
CRON_PATTERN=0 */6 * * *
Create a new entity on src/infrastructure/entity
yarn migrate:generate --migration=MIGRATION_NAME
Create a new entity on src/infrastructure/entity
yarn migrate:create --migration=MIGRATION_NAME
The transpiled files are created inside the dist folder. This name is defined on tsconfig.json file and to rename it you need to change the compilerOptions.outDir property.
npm run build
oryarn build
Comment the service shaman-king-bot
so that only the postgres
and pgadmin
are uncommented
mkdir data
<-- The folder where the database volume will be mounted
docker-compose build && docker-compose up -d
ormake start
npm run dev
oryarn dev
mkdir data
<-- The folder where the database volume will be mounted
docker-compose build && docker-compose up -d
ormake start
This repo has a Makefile with some useful commands to avoid running long docker commands
The bot was built using Docker so it doesn't depend on external services. It includes a PostgreSQL database and the PgAdmin dashboard so you can manage your data In order to do it:
-
Access
localhost:5050
and insert the credentials specified on thedocker-compose.yml
-
On the servers, add a new one with the desired name, for the host use
host.docker.internal
and put the credentials like on the .env file
For the docker-compose to be able to run, follow these steps https://stackoverflow.com/a/74119920/9661304