compiler-discord/README.md

78 lines
1.8 KiB
Markdown
Raw Normal View History

2019-03-12 10:09:46 +01:00
# Comp_iler
2019-05-17 02:29:24 +02:00
Sandboxed code execution discord bot.
[Invite the bot!](https://discordapp.com/oauth2/authorize?client_id=555066722969714728&scope=bot)
2019-03-12 10:09:46 +01:00
## Usage
````
2019-03-15 02:58:43 +01:00
>```cpp
#include <iostream>
int main()
{
std::cout << "Hello World!" << std::endl;
}
2019-03-12 10:09:46 +01:00
```
2019-05-15 03:05:12 +02:00
````
2019-03-12 10:09:46 +01:00
2019-05-15 03:05:12 +02:00
```
2019-03-12 10:09:46 +01:00
>`py print('hello world')`
2019-05-15 03:05:12 +02:00
```
2019-03-12 10:09:46 +01:00
2019-03-15 02:58:43 +01:00
## Supported Languages and Options
2019-03-12 10:09:46 +01:00
2019-03-15 02:58:43 +01:00
One of the following language codes is set in `lang`.
Options are optionally set in `options`, which is a semicolon-delimited list of `flag` or `flag=value`.
2019-03-12 10:09:46 +01:00
2019-05-25 21:03:40 +02:00
- `apl` APL
- `bash` Bash
2019-05-23 04:26:55 +02:00
- `bf` Brainfuck
2019-07-11 08:27:17 +02:00
- `c` C
- `clj` Clojure
2019-07-11 08:27:17 +02:00
- `cpp` C++
- `cs` C#
- `elixir` Elixir
2019-07-11 08:27:17 +02:00
- `fs` F#
- `go` Go
2019-07-11 08:27:17 +02:00
- `hs` Haskell
- `java` Java
- `js` JavaScript
- `julia` Julia
- `lisp` Racket
- `lua` Lua
- `ocaml` OCaml
2019-07-11 08:27:17 +02:00
- `pas` Pascal
- `php` PHP
- `pl` Perl5
2019-07-11 08:27:17 +02:00
- `prolog` Prolog
- `py` Python
- `rb` Ruby
- `rs` Rust
2019-05-15 02:24:16 +02:00
## How it Works
2019-07-11 08:27:17 +02:00
For every language there is a docker image which spins up a docker container.
2019-05-15 02:24:16 +02:00
The container is used for all evaluations of code, restarting if something goes wrong.
The container is locked down, so there is no networking, limited memory and CPU usage, and a time limit.
## Setup
2019-07-11 08:27:17 +02:00
0. Install [Docker 18+](https://www.docker.com/)
0. Install [Node 10+](https://nodejs.org/)
0. Install [Myriad](https://github.com/1Computer1/myriad)
- This will require [Stack 2+](https://docs.haskellstack.org/en/stable/README/).
- You will also have to configure Myriad, see its repository.
0. Fill out `config.json`
- `owner` The owner(s) of the bot. Use an array for multiple owners.
- `token` The bot token.
- `prefix` The prefix for commands.
- `codePrefix` The prefix for code evaluation.
- `myriad` The port that Myriad is running on.
2019-05-15 02:24:16 +02:00
0. Run `npm i`
2019-07-11 08:27:17 +02:00
## Running
0. Run `myriad --config path/to/config.dhall`
0. Run `node .`