Judge0

by nntin

GitHub Readme.md

Judge0Bot

Code execution in the chat

OverviewGet to the botUsageDevelopment

Overview

Judge0Bot is a Discord bot for interacting with the Judge0 API. It executes source code of near 20 programming languages directly in the Discord channel chat.

Get to the bot

The bot is hosted and this means that you can use its commands from a Discord server. Three of the ways of interacting with our bot in the Discord platform:

  1. Invite the bot in your server. You can invite the bot in servers which you manage with this invite link.
  2. Use the bot from our support server. You can use the bot from our Judge0 support server. Join the server here.
  3. Use the bot from programming servers. The bot is included in large IT related communties. discord.py, ITBG

Usage

The bot is quite easy and straightforward for use. There is integrated help command in the bot. Send ;help in the chat and the bot will send helpful information for usage.

Executing code

The code execution is done through sending a language command and passing the source code. You can view all language commands after sending ;languages in the chat. Every language command have three use cases (Python example):


;python print("Executing source code")

This command will execute the passed source code and it will return an output embed which includes information like time and memory usage and output which includes standart output, standart error, compiler message and sandbox message if any.


;python

If a language command is send without source code it will return an useful guide how to pass the source code. There are three methods: passing source code in plain format, passing soure code in code block or passing source code in highlighted code block.


;python -v

If argument -v is passed instead of source code it will return the version of the language.

Development

It is highly preferable if you don't run an instance of this bot unless you want to contribute.

The installation and running steps are as follows:

  1. Make sure to get git and Python 3.6 or higher

This is required to clone the repository and actually run the bot.

  1. Clone the repository

git clone https://github.com/judge0/discord-bot.git

  1. Enter the directory

cd discord-bot

  1. Install Pipenv

python -m pip install pipenv

  1. Install dependencies

pipenv install --dev

  1. Run the bot

Bot token passed like command-line argument:

pipenv run start <token>

Bot token set as enviorment variable BOT_TOKEN:

pipenv run start

Deployment

Deploy