Collaborative Discord Development Environment
What is Discord Colab?
Discord Colab is a collaborative development environment for People who just never leave Discord. 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 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
.
Using the
run
CommandThe 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.
Colab allows for the use of Containers, see Containers for more information.
ContainersColab 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.
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.
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.