Skip to content

RedBot cogs for OpenDream compiling Goonstation

License

Notifications You must be signed in to change notification settings

amylizzle/odgoon-cogs

 
 

Repository files navigation

OpenDream/Goonstation Cogs

Overview

A collection of RedBot cogs for running code against the Goonstation codebase with the OpenDream project

Forked from https://github.com/OpenDreamProject/od-cogs and lightly modified.

Cog Description
OD Compile Compiles and runs DM code using OpenDream.

gooncompileset - OD Compiler Settings
gooncompile - Sends code to a compilation environment and returns the results*

Requires: httpx

* Requires additional setup, check below for more information

Setup

RedBot:

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).

  1. Add this repo with [p]repo add odgoon-cogs https://github.com/amylizzle/odgoon-cogs
  2. Install the cog(s) you want to use, [p]cog install odgoon-cogs gooncompile
  3. Load the newly installed cog(s) with [p]load gooncompile

To use gooncompile's context commands, you'll also need to register the interactions with discord. To do so,

  1. Enable the commands with [p]slash enablecog gooncompile
  2. 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


GoonCompile

The GoonCompile 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/amylizzle/od-compiler-bot/tree/goon_compile

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()

Arguments

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
  • Quick compile
    • image
  • Using Goonstation code
    • image
  • Using the Unit Test framework
    • image
  • Standard compilerbot stuff
    • image

Contact:

For questions/concerns, feel free to submit a new issue.

About

RedBot cogs for OpenDream compiling Goonstation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%