This is a bot for highlight code and retrieves as an image. You can send your code to the bot and this is magically highlighted in an image that you can share with your mates!
The bot is available in Telegram here Send your message as follows:
- First, the language
- Second, the code
- Example:
javascript
function greet(name) {
console.log('Hello, ' + name)
}
To run your Telegram bot based on this repo, follow the next steps:
- Create a token for Telegram Bots API with BotFather
- Create your
.env
file based on.env.example
- Change the env vars according to your bot
- TELEGRAM_BOT_TOKEN: Token retrieved by BotFather
- WEBHOOK_URL: Webhook where Telegram send the updates (new messages or actions from users)
- SERVER_URL: URL for mapping files (code screenshots) for send
- PORT: The port where you want the bot to start
$ yarn
The server uses prismjs to highlight the code and puppeteer allows taking a screenshot of the result.
yarn dev
You could use ngrok for development purposes
First, we need to build the project:
yarn build
Second, start the server in the compiled folder:
node dist/index.js
- Add padding to the exported images
- Add custom themes
- Add more languages
- Capacity for edit images for edited messages
- Inline mode