Coder Social home page Coder Social logo

rycieos / slack-compilebot Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 26 KB

Compiles code snipits on Slack. Like /u/compilebot, but for Slack

License: GNU General Public License v3.0

Python 87.47% Dockerfile 6.78% Shell 5.75%
compile slack-bot slackbot

slack-compilebot's People

Contributors

rycieos avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

slack-compilebot's Issues

Unexpected newlines in stdin input

If a block like this is passed in as the "Input":

```
1
2
3
```

what slack actually is doing is this:

\n
1\n
2\n
3\n

since there is a newline character directly after and before the respective start and end.
This can be "fixed" by not including the newline when you type it:

```1
2
3```

but that doesn't look as clean. It would be simple to strip out a start and end character if they are '\n', but would it be too confusing?

Add way to search for language

When trying to use a new language, it's hard to guess what Sphere Engine is looking for in a string.

Add a way to specify a simple string like python, and have the bot return possible matches.

Ideally, it could do this as part of the normal code submit. If only one option came back, it would use that one, but if multiple did, then it would error and show the possible language options.

Too long return message gets dropped

This issue was originally discovered 2017-10-23, but apparently never logged on Github.

If this is passed to compilebot:

@compilebot python

while True:
  pass

compilebot will correctly return:

@Rycieos: There was an error processing your code:
Time limit exceeded

But, if this is passed:

@compilebot python

while True:
  print("test")

compilebot will never appear to return anything.

What actually happens is that the text the bot is trying to send to Slack (when the compile times out) is too long and the connection breaks. Slack's docs (https://api.slack.com/methods/chat.postMessage) suggest that "a single message should be no larger than 4,000 bytes".

An easy fix would be to truncate the message after a certain number of characters. Slack's 4,000 byte limit claims to be for the text field, so chopping anything larger than 4,000 bytes to 3,950 or so and adding a "message was truncated" message is probably the best solution.

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.