GithubHelp home page GithubHelp logo

weechat-slacklog's Introduction

ARCHIVED: This project has been archived. The original authors no longer use it and Slack is currently phasing out the API it relies on.

Slacklog

Pull Slack chat history in when opening a new buffer.

shot

Installation

This script is not yet released, please install manually:

% curl -o ~/.weechat/ruby/slacklog.rb \
  "https://raw.githubusercontent.com/thoughtbot/weechat-slacklog/master/slacklog.rb"

Optionally set the script to autoload when WeeChat starts:

% cd ~/.weechat/ruby/autoload && ln -s ../slacklog.rb .

Restart WeeChat or load the script manually:

/script load slacklog.rb

Required Settings

Note: You can generate an API token here.

/set plugins.var.ruby.slacklog.servers "thoughtbot"
/set plugins.var.ruby.slacklog.thoughtbot.api_token "abc-123"

These variables can also be modified via the /slacklog command:

/slacklog add thoughtbot abc-123

Optional Settings

By default, the Slack API returns 100 messages when no count is specified. You can change this by setting a value between 1 and 1000:

/set plugins.var.ruby.slacklog.count 500

To change the color of Slacklog lines, change the following WeeChat setting:

/set logger.color.backlog_line darkgray

Usage

Whenever you open a buffer for a server in your servers list (and which has a token defined), 100 messages of history will be fetched via the Slack API and printed into the buffer.

The /slacklog command can be used without arguments to actively fetch and print history for an already open buffer.

Implementation Details

The script can be used outside of WeeChat like so:

% ruby ./slacklog.rb fetch API-TOKEN CHANNEL

This prints history messages on stdout and has no dependencies on the Weechat module. The implementation is contained in a normal SlackAPI class which is well tested.

Global functions wire this up as a WeeChat plugin in the following way:

  • Whenever a channel is joined or the /slacklog command is invoked, we determine the token and channel then ask Weechat to asynchronously execute our script as above with a callback.
  • The callback will receive the lines output by our script, and print them into the buffer.

weechat-slacklog's People

Contributors

pbrisbin avatar calleluks avatar seiji 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.