The executor is a discord bot that allows you to execute scripts within discord.
Scripts are executed inside Docker containers so it provide a safe execution environment.
All you have to do is markdown the code you want to execute followed by the !run
command.
Example :
```py
print("Hello World!")
```!run
Want to manipulate file and get back the result ?
Simply follow the previous step and register your file to ./resources
so The Executor can easily find it and send it back to you.
Example :
```py
import matplotlib.pyplot as plt
fig, ax = plt.subplots(nrows=1, ncols=1)
ax.plot([0, 1, 2], [10, 20, 3])
fig.savefig('resources/fig.png')
plt.close(fig)
```!run
The resulting file should be returned back to you diectly on discord !
The Executor need Docker and python to work properly.
First you'll need to run :
./setup.sh install
The installation will pull Docker images and install the requirements.txt modules.
To run The Executor, you have to configure config.yaml to define your API_KEY, scope and exec.
The configuration file config.yaml is composed of the following variables :
exec:
# Timeout before script is being killed by Subprocess.
timeout: INT
bot:
# API Key of your discord bot, see https://discord.com/developers/applications
API_KEY: "YOUR_DISCORD_API_KEY"
server:
# Define The Executor permissions
scope:
channels:
- "CHANNEL_ID"
roles:
- "ROLE_NAME"
Then finally, run bot.py
python bot.py
For safety reasons, each execution is made inside docker containers, so it provide a safe execution environment.
All script exceeding TIMEOUT are killed. You can define [Discord roles] so you can choose who can execute script within your server.
For now The Executor support the following languages :
- Interpreted :
- Python
- Javascript
- PHP
- Bash
- Compiled :
- C
- C++