Skip to content

1. Getting Started

Headline edited this page Feb 12, 2025 · 7 revisions

Welcome

Hello new Compiler bot users!

Compiler bot supports lots of different things, so bear with this quick guide for a moment to get you up to speed.

First things first check out the bot's ;help command. For more specific help on a command you can execute ;help <cmd>.

1. Limitations

Keep in mind that we're working in discord. This means, of course, that we have many operating restraints. Here's a few of the big ones.

  • Complicated syntax for non-trivial compilations (see advanced usage guide)
  • Limited output length (limited to a couple hundred characters)
  • Single-file input only

2. Hello World

Here's an example with a compilation request for a hello world program in python.

Figure 2.1

;compile
```python
print("Hello world!")
```

Code Blocks

If you don't already know: ``` indicates the start and end of a code block, by putting the language immediately after the first set of them, discord will syntax-highlight your code.

```py
print("Hello world!")
```

Most of the time the compiler bot is able to detect the programing language from the syntax-highlight language, but you may explicitly specify it, too. That looks like the following.

Figure 2.2

;compile python
```
print("Hello world!")
```

If your code doesn't compile, edit your original message and the bot will re-run it. Or if you give up just delete your message and the bot automatically will delete its response.

3. Other Languages & Compilers

Compiler supports many different languages with many different compilers. Lets take a look at how to view them.

3.1 Languages

If you want to see all of the languages compiler supports, type ;languages.

3.2 Compilers

If you want to see all compilers/interpreters you can use for any language, you can type ;compilers <language>. For example, ;compilers c++.

*Note: Keep in mind the bold text for each compiler type. If you want to use a specific compiler, then this bolded text must be specified instead of the language like in figure 2.2.

3.3 Assembly

Any language shown in the ;languages list that has an asterisks(*) can have it's assembly inspected. Instead of ;compile you will use ;asm, but its usage is the same.

3.4 Formatting

If someone ever posts code that is ill-formatted you may reply to the message containing the codeblock and type ;format. See ;formats for all options, but the default (clang-format's WebKit) should work fine for most situations.

4. C++ Insights

You may use ;insights to quickly send a codeblock to cppinsights.io

5. Advanced Usage

If you're interested in what more you can do with Compiler, check out the advanced usage guide! Here we talk about compiler flags, stdin, and other goodies.

6. Support Server

Once again if you have any questions visit our support server and we can help you out! Or come just to say hi and bring us some 🍪s.

7. How does it work?

Compiler bot is simply an extension of godbolt.org and wandbox.org to discord. This project does not compile or execute code itself, it relies on the mentioned services to do so. This allows us to focus on the discord interface and user experience, while avoiding some of the heavy lifting. I encourage you to check out these services and contribute to them if you're able.