A collection of RedBot cogs for the OpenDream project
Cog | Description |
---|---|
OD Compile | Compiles and runs DM code using OpenDream.odcompileset - OD Compiler Settingsodcompile - Sends code to a compilation environment and returns the results*odcompiledebug - Sends code to be compiled using a debug build of OpenDream*Requires: httpx * Requires additional setup, check below for more information |
Setup for your RedBot V3 instance is a straightforward process. Ensure that your bot runs on python 3.11 and follow the below steps to add the repo and install the cog(s).
- Add this repo with
[p]repo add od-cogs https://github.com/OpenDreamProject/od-cogs
- Install the cog(s) you want to use,
[p]cog install od-cogs odcompile
- Load the newly installed cog(s) with
[p]load odcompile
To use odcompile's context commands, you'll also need to register the interactions with discord. To do so,
- Enable the commands with
[p]slash enablecog odcompile
- Sync the interactions with
[p]slash sync
(Note: This can take up to 1-hour for Discord to fully sync the commands)
Replace [p] with your bot's prefix
The ODCompile cog parses provided DM code and sends it to an external environment which will compile, run, and generate an output to be returned in Discord.
In order to use this cog, you will need to either use a preestablished environment or host your own using this listener: https://github.com/OpenDreamProject/od-compiler-bot
Short one-liners can be provided in basic code-markdown, for example:
world.log << "Hello, World!"
Multi-line or explicit code must be contained within a codeblock, for example:
world.log << 'Hello,'
world.log << "World!"
If you're using multiple functions, or if your code requires indentation, you must define a /proc/main()
as shown below.
/proc/example()
world.log << "I'm an example function!"
/proc/main()
example()
You can pass extra command line arguments to the compiler by adding them before the codeblock.
Adding --no-parsing
before the codeblock will provide the full execution output instead of a parsed version.
Code will always be compiled with the latest version of OpenDream
Example screenshots
For questions/concerns, feel free to submit a new issue.