GithubHelp home page GithubHelp logo

chen-ye / hubot-longtext Goto Github PK

View Code? Open in Web Editor NEW

This project forked from claudebot/hubot-longtext

0.0 3.0 0.0 18 KB

A Hubot script for handling long messages by returning a link to an online paste containing the message.

License: Other

JavaScript 23.43% CoffeeScript 63.04% Shell 13.53%

hubot-longtext's Introduction

hubot-longtext

Build Status devDependency Status

This script relies on a new Hubot v2.17.0 feature known as 'response middleware'. It WILL NOT work on older versions of Hubot.

A Hubot script for handling long messages by returning a link to an online paste containing the message.

This script is useful for automatically capturing long Hubot responses (e.g. help text) that would otherwise flood your chat channel / room. A captured response is then converted into an online paste, and a link to the paste is returned.

Process

  • If enabled, check if the number of string lines is more than HUBOT_LONGTEXT_MAX_LINES (accounts for \n, and \r);
  • If the previous condition is not met, check if the number of characters for each string exceeds HUBOT_LONGTEXT_MAX;
  • If any of the condition above is met, the string is exported to an online paste.

See src/longtext.coffee for full documentation.

Installation via NPM

  1. Install the hubot-longtext module as a Hubot dependency by running:

    npm install --save hubot-longtext
    
  2. Enable the module by adding the hubot-longtext entry to your external-scripts.json file:

    [
        "hubot-longtext"
    ]
  3. Run your bot and see below for available config / commands

Configuration

Variable Default Description
HUBOT_LONGTEXT_MAX 300 Any message sent by Hubot that is longer than HUBOT_LONGTEXT_MAX string characters will be replaced with a link to the paste containing the message
HUBOT_LONGTEXT_MAX_LINES false Any message sent by Hubot with more than HUBOT_LONGTEXT_MAX_LINES string lines will be replaced with a link to the paste containing the message (disabled by default)
HUBOT_LONGTEXT_SERVICE Dpaste (TBA)

Sample Interaction

user1>> hubot help
hubot>> http://dpaste.com/0TGWQ8T

hubot-longtext's People

Contributors

mrsaints avatar

Watchers

James Cloos avatar Chen Ye avatar  avatar

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.