Giter Site home page Giter Site logo

syntax-highlighter-bot's Introduction

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 [email protected]: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

Donate

  • BTC 3F275vPSCvYW19MHZqSjw79fEwwU4MbTgV
  • LTC MGMCQB3QAcrSBjU3eGJviqB2J2f5BNVRGr
  • DOGE D5m69FRDGEn3G3xuakvqTxUpGVt6NegKJp

syntax-highlighter-bot's People

Contributors

dependabot[bot] avatar piterden avatar roziscoding avatar shavidzet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

syntax-highlighter-bot's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.