compiler-discord/README.md

53 lines
1.4 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.
2019-09-05 16:32:26 +02:00
[**Invite the bot!**](https://discordapp.com/oauth2/authorize?client_id=555066722969714728&scope=bot)
*Not all languages are enabled on the public bot.*
2019-03-12 10:09:46 +01:00
## Usage
2019-09-05 16:32:26 +02:00
````cpp
$>```cpp
2019-03-15 02:58:43 +01:00
#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-09-05 16:32:26 +02:00
```py
$>`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
2020-06-17 10:38:20 +02:00
A supported language code is set in `lang`.
2019-07-22 01:04:52 +02:00
You can see all the possible codes using the `languages` command in the bot.
2019-03-12 10:09:46 +01:00
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-09-05 05:58:40 +02:00
1. Install [Docker 18+](https://www.docker.com/)
2020-06-17 10:38:20 +02:00
2. Install [Node 14+](https://nodejs.org/)
3. Install [Myriad 0.4.0.0](https://github.com/1Computer1/myriad/)
2019-09-05 05:58:40 +02:00
4. Fill out `config.json`
2019-07-11 08:27:17 +02:00
- `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-09-05 05:58:40 +02:00
5. Run `npm i`
2019-07-11 08:27:17 +02:00
## Running
2019-09-05 16:32:26 +02:00
1. Run `myriad --config /path/to/config.dhall --languages /path/to/languages/`
2019-09-05 05:58:40 +02:00
2. Run `node .`