Skip to content

🤖 Discord bot for interacting with Judge0. Run code from Discord chat.

License

Notifications You must be signed in to change notification settings

judge0/discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Judge0Bot

Code execution in Discord chat

Overview • Get to the bot • Usage • Development

Overview

Judge0Bot is a Discord bot for interacting with the Judge0 API. It executes code from nearly 20 programming languages directly in your Discord server.

Get to the bot

The bot is hosted and this means that you can use its commands in a Discord server. There are three ways of interacting with our bot on Discord:

  1. Add the bot to your own server. You can add the bot to servers where you have the Manage Server permmision with this link.
  2. Use the bot in our support server. You can use the bot in the Judge0 support server. Join the server here.
  3. Use the bot in major programming servers. The bot is included in large IT related communties like discord.py and ITBG!

Usage

The bot is quite easy to use. Send ;help in the chat and the bot will give you helpful information for usage.

Executing code

Code execution is done through sending a language command with the code you want to execute. You can view all supported languages by sending ;languages in the chat. Every language command has three use cases (Python is used here as an example):


;python print("Executing source code")

This command executes the code provided andreturns an embed which includes information like the time it took to execute, memory usage and the code's output including standart output, standart error, compiler messages and sandbox messages (if any).


;python

If a language command is sebt without any code it will return an useful guide on how to pass the code. There are three methods: passing the code in plain text, passing the code in a code block or passing the code in a highlighted code block.


;python -v

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

Development

It is highly prefered 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 run the bot.

  1. Clone the repository

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

  1. Go to the directory

cd discord-bot

  1. Install Pipenv

python -m pip install pipenv

  1. Install the required dependencies

pipenv install --dev

  1. Run the bot

Set the bot token as enviorment variable (BOT_TOKEN): Set the Rapid API auth key as enviorment variable (AUTH_KEY): Get your auth key from here: Judge0 Rapid API

pipenv run start