This is a Telegram bot that reads image links of various sources from a source chat and processes it to send the image and a custom-formatted caption to another (or the same) telegram chat/group.
At the moment the following sources are supported thanks to the usage of third part libraries:
- Twitter (twitter-scrapper)
- Pixiv (pixiv.ts)
- Booru (booru)
The bot can be deployed through docker making use of the following docker-compose
version: '3.4'
services:
tip:
image: juanikus/telegramimageposter:latest
volumes:
- .\config.json:/app/config.json
Or downloading the repository and running
npm start
Note:
The first time the program is launched telegram will ask through the console for a verification code sent to your account.
The providers to use, their credentials and the caption can be configured through a config.json
file (which needs to be created). A config-sample.json
file is provided with dummy data
Telegram configuration needs to include the AppId and AppHash for your account, which can be found through the following link, loging in with your phone number > developer tools.
The session entry needs to be empty, once the first login is performed the session key will be stored in this field for future logins
The Pin entry can be left empty if no pin is configured on your telegram account.
In order to use pixiv provider a valid AccessToken and RefreshToken need to be provided to it's configuration. Information on how to extract this token can be found on the following link
The booru section in config consists on a list of booru websites that you want to process urls from. A complete list of supported sites can be found here
The caption can be customized with a certain set of variables available for each provider. The caption can also contain markup, which will be interpreted by telegram.
In this sample, the caption will be a the author's name between [brackets] and bolded, and a link to the original source
{
"caption": "<b>[%author%]</b> <br> <a href='%url%'>Source</a>"
}
- %url% -> The URL of the original Post.
- %author% -> The account's name.
- %caption% -> The text of the tween.
- %url% -> The URL of the original Post.
- %author% -> The account's name.
- %caption% -> The caption of the pixiv post.
- %tags% -> comma separated list of tags.
- %url% -> The URL of the source (if any).
- %posturl% -> The URL of the booru Post.
- %author% -> The account's name.
- %tags% -> comma separated list of tags.