Omniplex
Back to bots
DisColab
DisColab

DisColab

Discord Colab - Coding from within Discord

Discord Colab

Collaborative Discord Development Environment

What is Discord Colab?

Discord Colab is a collaborative integrated development environment right from within Discord, because why not. It is similar to Jupyter/Google Colab (Hence the Name), but instead of Jupyter Notebooks, it uses Discord.

How does it work?

Being in a regular Server, Colab will not do anything. To create a new Project, you type the command colab new <Project Name>. This will create a new Server,
which serves as the Project's workspace. You can invite people to this Server, and they can collaborate with you on the Project.

Files are represented as Channels in the Server. You can create new files by creating new Channels, and you can edit them by sending messages to the Channel.
Code is recognized when it is sent in a Code Block, and it will automatically be written to its respective file.

Filenames

Filenames are determined by the Channel's name. For example, a Channel named main-py will be written to a file named main.py.
Since Discord does not allow special characters in Channel names, the following replacements are made:
- The last hyphen in the Channel name is replaced with a period. For example, main-py becomes main.py, and test-file-py becomes test-file.py.

Running Code

Using the run Command

The run command is used to run code in a file. Importantly, for it to work, a "rulefile" is required. You can set it up by running the colab rulefile command.

Once the rulefile is set up, you can run code in a file by using the run command. For example, to run the code in main.py, you would use the command colab run inside the main-py Channel.

Using Containers

Colab allows for the use of Containers, see Containers for more information.

Containers

Colab allows for the use of Containers. Containers are isolated environments that can be used to run code.

To create a new Container, you can use the colab container init [image] command. This will create a new Container, with the specified image.
If you do not specify an image, the default image (python:3.9) will be used.

To communicate with the Container, you can use the colab container exec [command] command. This will execute the specified command in the Container.

You can also use the colab container tty command to create a thread which acts as a terminal to the Container.

Please note that Containers are not persistent. Once you stop the Container, all data will be lost. Containers are also destroyed 3 hours after they are created.
Another note: This Bot runs on an old computer of mine, which has limited resources. Please do not abuse the Container feature.

Git

Colab has a built-in Git client. You can use the colab git command to interact with Git. The following commands are supported:
- colab git init - Initialize a new Git repository.
- colab git add [file] - Add a file to the staging area.
- colab git commit [message] - Commit the staged files.
- colab git push - Push the committed changes to the remote repository.
- colab git pull - Pull the latest changes from the remote repository.
- colab git remote add [name] [url] - Add a remote repository. -colab git remote remove [name]` - Remove a remote repository.

Filesystem

Colab has built-in minimalistic Filesystem Support. You can use the colab fs command to interact with the Filesystem. The following commands are supported:
- colab fs ls - List all files in the current directory.
- colab fs cd [directory] - Change the current directory.
- colab fs mkdir [directory] - Create a new directory.
- colab fs touch [file] - Create a new file.
- colab fs rm [file] - Remove a file.
- colab fs rmdir [directory] - Remove a directory.
- colab fs pwd - Print the current directory.

Note that relative paths are only supported for the cd command. All other commands require the full path.

LXDE

For no real Reason at all, Colab supports LXDE (The Lightweight X11 Desktop Environment). You can manage LXDE using the following commands:

  • colab lxde start - Start the Session
  • colab lxde mc -Mouse Click
  • colab lxde md [by] - Move the Mouse DOWN by [by]
  • colab lxde ml [by] - Move the Mouse LEFT by [by]
  • colab lxde mu [by] - Move the Mouse UP by [by]
  • colab lxde mr [by] - Move the Mouse RIGHT by [by]
  • colab lxde push - Push the project files to the container
  • colab lxde pull - Pull the project files from the container
  • colab lxde reload - Reset the screen
  • colab lxde ss - Refresh the Screen (This might help if nothing happens after an action)
  • colab lxde push - Push the project files to the container
  • colab lxde sendkeys [keys] - Type [keys]
  • colab lxde close - Kill the container

Legal Stuff

Colab is GDPR-Compliant. View information using colab gdpr, or decide to exercise your rights using colab gdpr comply

Encryption

Assuming you're not actively coding, but want to secure your project from any data breaches, you can encrypt (and decrypt) your project with RSA-Encryption.

  • colab rsa generate_key - Generate an RSA Keypair and Encrypt the project
  • colab rsa remove_rsa - Unlock your project and dismiss the Keypair

Turning your Project into Code

Once you are done with your Project, you can turn it into a .TAR.GZ file by using the colab release command. This will create a .TAR.GZ file containing all the files in the Project.

Similar Bots