Code Monkey home page Code Monkey logo

discocode's Introduction

DiscoCode

image

Your friendly neighborhood containerized code execution web server and discord bot.

Safe and secure. Powered by Piston. Includes a REST API for code running, user admin, and database management.



General Requirements

Running the discord bot requires a discord developer account, and a bot created/invited (via your developer account) to your chosen discord server.


Installation (Recommended Method)

Linux (Fully Automated)

curl https://raw.githubusercontent.com/nickheyer/DiscoCode/main/auto_install_update.sh -o auto_install_update.sh && sudo bash auto_install_update.sh

Other Operating Systems (Windows, Mac, etc.)

Download Docker Image (Recommended - x86_64 Architecture)
docker image pull nickheyer/discocode:latest
OR Download Docker Image (ARM64, aarch64 Architecture, ie: Raspberry-Pi, Mac M1, etc.)
docker image pull nickheyer/discocode_rpi:latest
Run Docker Container
docker run -d -p 6565:6565 --name discocode nickheyer/discocode
The server within the docker container can be accessed locally at http://127.0.0.1:6565


Installation From Source (Not Recommended)

Prerequisites, Dependencies, and Requirements

NOTE: Installation from source using Windows has been deprecated with the introduction of web-socket functionality, gevent, and other integral parts of this application that are not currently supported by Microsoft.

  1. Python - Download and install Python here. Make sure that you choose "Add Python to environmental variables" during installation.
  2. Git - Download and install Git here

Next Steps

  1. Change directory to preferred install location
cd /where/you/want/this/installed
  1. Clone DiscoCode
git clone https://github.com/nickheyer/DiscoCode
  1. Change directory to DiscoCode
cd ./discocode
  1. Install Requirements
pip install -r requirements.txt
  1. Run Migrations
python manage.py migrate
  1. Run DiscoCode
sh ./run.sh


General Instructions

Accessing The Web-UI

You will need to get the IP address of the computer hosting DiscoCode. On Windows, you would typically type ipconfig on the host machine and look for your ipv4.

If you would like to access DiscoCode remotely, as in not on the same network as the host machine, you will need to do some port forwarding to expose port 6565 to the internet. Run into trouble? Feel free to join the Discord!


Configuration

DiscoCode requires a small amount of configuration before you can begin making requests. Discord Token for example.


To get your Discord Token, go to the "bot" tab in your developer portal. You may need to click "reset Token" and/or enter authentication code if you have 2FA enabled. Make sure to enable all Privileged Gateway Intents)

Peek 2023-05-22 22-06

If you haven't already, now is also a good time to invite the bot to the server or servers you would like to monitor, you can do that via the Discord Developer Portal. Admin access is the only level we have tested. Anything less may result in errors.

Peek 2023-04-07 20-01



Usage

Add Yourself As An Admin

In the Web UI, click "Users". Add yourself as a user, but before confirming, change "Non-Admin" to "Admin". Your username should match your Discord username. These are automatically populated in the search bar when the bot is running and can see other users.

Test That The Bot Is Running

Type the following into a discord chat message that the bot can see:

!dc help

Features ๐ŸŒŸ

  • Multi-Language Support: Execute code in a plethora of languages - from mainstream ones like Python, Java, C++, JavaScript, to esoteric ones like Rockstar, Cow, and Lolcode.

  • Containerized Execution: Ensures safe and isolated code execution environment.

  • Discord Integration: Directly execute code from Discord with an easy-to-use command system.

  • User Roles and Authorization: Manage permissions with roles like admin, user, unrestricted, and owner.

  • User Debug Information: Quickly access user roles and registered commands.

How to Use ๐Ÿ“˜

To execute code, use the prefix for code execution ($ by default), followed by three backticks and the language that you would like to code in. Then, on a new line below that, you can start writing code. End it with a new line and another three backticks.

  $```python
  print("Hello, DiscoCode!")
  ```

Contributing ๐Ÿ’ผ

Feel free to fork this repository, add your features or improvements and create a pull request. We are excited to see your creative ideas!

License ๐Ÿ“„

This project is licensed under the MIT License - see the LICENSE.md file for details.

Happy Coding! ๐Ÿš€

discocode's People

Contributors

nickheyer avatar

Stargazers

 avatar  avatar  avatar Cesar Arturo Solano avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.