Giter VIP home page Giter VIP logo

discord-bot's Introduction

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

discord-bot's People

Contributors

hermanzdosilovic avatar rexogamer avatar skilldeliver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

discord-bot's Issues

Submission tracking

Hi @skilldeliver,

I have a feature request that I think might be useful for us to know how many and what submissions have been made with the bot.

I would like to have a simple SQLite database with the single table submissions that has two attributes: token and created_at. The first attribute token would be a token of a submission that was created and the second attribute would be a date and time of when that submission was created. Both values should be taken from actual submission (to have consistent values).

Let me know what you think.

BR,
Herman

Option to delete bot output, and to re-run bot on code block

Hello!

In using the Discord bot, it's inevitable that a typo happens, causing wrong output, and needing to re-enter code to get the right output.
I primarily use the bot to help with teaching and learning languages with people on Discord, and when there's a typo like this, the chat gets clogged with many Judge0Bot messages.

It would be great to have the ability to somehow:

  1. Ask the bot to re-evaluate some code and replace its output with the new output
  2. Ask the bot to delete one of its output messages

Reasons you might want to delete is if multiple people try the same thing and you're trying to tidy the chat up, an error happened and you don't want to re-run, or maybe somebody ninja'd you.

I've seen controls for bots on Discord implemented elsewhere by use of Reactions, and I think that's worth considering here for controls. Maybe a re-play πŸ” 'button', or have it re-run automatically when the original message is edited (if possible, not familiar with Discord's API)

Thanks!

And thanks for the bot & eval service, both are very useful.

Add License

If you find software that doesn’t have a license, that generally means you have no permission from the creators of the software to use, modify, or share the software. Although a code host such as GitHub may allow you to view and fork the code, this does not imply that you are permitted to use, modify, or share the software for any purpose. - choosealicense.com

Please add a license. Currently potential contributors do not have the permission to develop on their own discord bot instance. They have a right to fork the project as per GitHub ToS but they do not have permission to modify it and running their own local instance.

Cannot run the bot!

I have done every step with an admin command prompt until the part where it comes to pipenv run start <token>.
I first did that code and it threw this error:

Traceback (most recent call last):
  File "F:\Anaconda\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "F:\Anaconda\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "F:\Python\JudgeBot\discord-bot\bot\__main__.py", line 23, in <module>
    token = sys.argv[1] if len(sys.argv) > 2 else os.environ["BOT_TOKEN"]
  File "C:\Users\taysi\.virtualenvs\discord-bot-ZAz7AEEA\lib\os.py", line 678, in __getitem__
    raise KeyError(key) from None
KeyError: 'BOT_TOKEN'

Then I went into my environment variables and added BOT_TOKEN with a value of my token. Then I tried pipenv run start but it threw the same error.

Competitive programming feature

Develop a competitive programming feature where the user can read a problem-solving description, then post its solution and finally, the bot should return test case statuses.

Don't understanding

Hello, I was going to use the bot to troll a friend on his server but I'm not understanding how and where have I to put the token of my bot.
Thank you.

Crashed display of the main bot developer

The displaying of the bot main developer is currently crashed due to transferring the Judge0Bot application from the personal profile of Skilldeliver to the newmade team of Judge0

image

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.