Discord changed their client to prevent sending messages
that are preceeded by a slash (/)
To run code you can use "./run"
or " /run"
until further notice
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] (-> [output syntax] (optional))
[args (optional)]
```[syntax]
<your code>
```
[stdin (optional)]
- You have to provide either
language
orsyntax
- You can provide command line arguments by specifying them before the codeblock
- Each line corresponds to one argument
- You can provide standard input by specifying it after the codeblock
- 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
/run [language] (-> [output syntax] (optional))
[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
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 output syntax
functionality.
- The
/run
command will now take an additional output syntax highlighting code on the first line after a->
For example
/run cs -> json
will highlight the resulting output in discord as json.
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