Code Monkey home page Code Monkey logo

slack-today-i-did's Introduction

slack-today-i-did

A chat-ops bot designed around the principle of ensuring that types for functions are correct.

Features

  • slack and repl support
  • live-reload of functions
  • live-reload of the entire project
  • type safe interactions
  • useful error hints
  • enable/disable features at runtime
  • command history

Setup

  • You must have Python 3.6 installed

  • Use virtualenv

  • To install deps run pip install -r requirements.txt

  • In order to use this bot, you must create a file called priv.json which looks like this:

{
    "token": "<SLACK_BOT_TOKEN>",
    "rollbar-token" : "<ROLLBAR_READ_TOKEN>",
    "github" : {
        "token" : "<GITHUB_OAUTH_TOKEN",
        "repo" : "NoRedInk",
        "org" : "NoRedInk",
        "folder" : "repos"
    }
}

Running

  • python main.py starts up the slack bot by default
  • python main.py --repl starts up the local repl

slack-today-i-did's People

Contributors

eeue56 avatar ento avatar

Stargazers

Tommy Jocumsen avatar  avatar Johannes Gorset avatar José Cage  avatar Joel Howard-White avatar Scott Corgan avatar Thomas Weiser avatar

Watchers

 avatar Michael Glass avatar Joshua Leven avatar James Cloos avatar  avatar Aaron Strick avatar  avatar

slack-today-i-did's Issues

thoughts on UI

as I start using this, will start adding my thoughts on usability here.

Support "help" command

My instinct when using a bot is to type help in a DM to get some explanation of what I can do.

CommandHistory can't save the new function args format

TypeError: Object of type 'UnionMeta' is not JSON serializable
Traceback (most recent call last):
  File "main.py", line 29, in <module>
    main()
  File "main.py", line 22, in main
    client = setup()
  File "main.py", line 18, in setup
    return TodayIDidBot(data['token'], rollbar_token=data['rollbar-token'], elm_repo=repo)
  File "/home/ec2-user/slack-today-i-did/slack_today_i_did/bot_file.py", line 47, in __init__
    self._setup_command_history()
  File "/home/ec2-user/slack-today-i-did/slack_today_i_did/bot_file.py", line 65, in _setup_command_history
    self.command_history.load_from_file(known_functions, self.command_history_file)
  File "/home/ec2-user/slack-today-i-did/slack_today_i_did/command_history.py", line 13, in wrapper
    f(self, *args, **kwargs)
  File "/home/ec2-user/slack-today-i-did/slack_today_i_did/command_history.py", line 54, in load_from_file
    as_json = json.load(f)
  File "/usr/local/lib/python3.6/json/__init__.py", line 298, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/local/lib/python3.6/json/__init__.py", line 353, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 817 (char 816)

All user defined functions should return a type which is then fed into send_message

  1. functions and statements should return something like ChannelMessage. Basically, no user-defined function should really be called self.send_channel_message - instead, it should just return things and whatever it returns gets sent. This will help reduce multiple payloads and make point 2 easier to implement
  2. All functions should return things to the channel for the channel to use (e.g NOW should send the current time to the slack channel)

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.