🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

github.com/piterden/syntax-highlighter-bot

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
s

github.com/piterden/syntax-highlighter-bot

v1.0.14
94

Supply Chain Security

100

Vulnerability

100

Quality

100

Maintenance

100

License

Network access

Supply chain risk

This module accesses the network.

Found 1 instance in 1 package

Dependencies have 30 high and critical alerts.

Critical CVE, Socket optimized override available, High CVE, and Unstable ownership

Version published
Created
Issues
8

Syntax Highlighter Bot

Travis (.org) GitHub search hit counter GitHub code size in bytes

The bot for creating an image with highlighted code from a message.

Overview

This bot was written on top of the Telegraf.js bot framework, so all you need to have is the Node.js > v6.

Usage

Demo (WIP version).

The bot listens for entities type of pre in any text message. It means, it will render all pieces of text, wrapped in triple backticks (multiline code). Also you could force the language, writing its name on the first line, right after backticks. Just like on the GitHub.

Look at the example of a code should be handled by the bot:

\`\`\`js
/**
 * Show themes list
 */
bot.command('theme', (ctx) => isPrivateChat(ctx)
  ? ctx.replyWithMarkdown(
    messages.themeChoose(ctx.state.user.theme),
    Markup.keyboard(themesKeyboard(themes)).oneTime().resize().extra()
  )
  : ctx.reply(messages.themeGroup)
)\`\`\`

Commands

  • /start - Initial launch of the bot.
  • /theme - Shows the list of included themes and allows you to select a theme which you like more.
  • /langs - Shows the list of supported languages.

Installing

First of all clone this repository and install dependencies. Run in the terminal:

$ git clone git@github.com:Piterden/syntax-highlighter-bot.git
$ cd syntax-highlighter-bot
$ npm i

Then you need to create and fill the new .env file:

$ cp .env.example .env
$ editor .env

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

FAQs

Package last updated on 04 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts