Source code for the "I Run Code" Discord Bot used to run code snippets inside Discord chats.
You can add me to your server here
To see a list of supported languages click here
If you have questions check by our Discord Server
engineer-man/piston is the api that actually runs the code.
/run [language]
```[syntax]
<your code>
```
- You have to provide either
language
orsyntax
/run [language]
[arg1]
[arg2]
```[syntax]
<your code>
```
- You can provide command line arguments by specifying them before the codeblock
- Each line corresponds to one argument
/run [language]
```[syntax]
<your code>
```
[input]
- You can provide standard input by specifying it after the codeblock
/run [language]
[args1]
[args2]
[stdin1]
[stdin2]
<attached_file>
- You can attach a file with source code instead of providing a codeblock (Maximum file size is 65535 bytes)
- If you don't specify the language the bot will use the file extension
- You can specify command line arguments and stdin in the command.
- command line arguments should directly follow the
/run
line - stdin is everything that follows after the first double newline
- command line arguments should directly follow the
- Please note that attachments can not be edited therefore you can not use the edit functionality if you provide a source file
- You can edit your last
/run
message if you make a mistake and the bot will edit it's initial response. - You can delete the last output message (that was caused by you) with
/delete
or/del
or by deleting your most recent/run
message
If you want to contribute you can just submit a pull request.
Please style your code according to these guidelines:
- maximum line length is 99 columns
- use 4 spaces for indentation
- files end with a newline
- lines should not have trailing whitespace
If you want to use an auto formatter please use autopep8
Example config for VSCode:
"[python]": {
"editor.rulers": [
99
],
"editor.tabSize": 4,
},
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"editor.trimAutoWhitespace": true,
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": ["--max-line-length", "99"],
Added delete
functionality.
- The
/delete
or/del
command will make the bot delete it's last output (that was caused by the caller) - If you delete your most recent
/run
message the corresponding output will also be deleted.
Made writing rust code "snippets" easier (Thanks https://github.com/UsairimIsani)
fn main() { }
will be automatically created if it is not present in the provided code.
Made writing java code "snippets" easier (Thanks https://github.com/Minecraftian14)
When typing Java code the boilerplate code for public class
will be added automatically.
/run java
```
import java.util.List;
List.of(args).forEach(System.out::println);
```
will be interpreted as
/run java
```
import java.util.List;
public class temp extends Object {
public static void main(String[] args) {
List.of(args).forEach(System.out::println);
}
}
```
Added optional command line parameters You can use them by specifying them before the codeblock (1 per line)
Example:
/run <language>
parameter 1
parameter 2
```
<your code>
```
Added optional standard input You can use standard input by specifying it after the codeblock
Example:
/run <language>
```
<your code>
```
standard input