Skip to content

Coding module

FrenchMasterSword edited this page Jun 6, 2019 · 6 revisions

Coding module

Commands

run

Execute code in a given programming language, through tio.run

If execution takes more than 60 seconds, it will be aborted and the output will not be given.

Usage: do run <language> [--wrapped] [--stats] <code>

  • language is the language's name the code shall be executed with.
  • code is the code to execute
Basic example

basic example

The 🗑️ allows you to delete the bot's output under 60 seconds. Useful to remove a useless syntax error.

Of course you can use markdown's code blocks, with or without syntax coloration.

Example

codeblocks

In fact, if you are using a codeblock with the appropriate syntax coloration, you don't even have to specify the language. If you still specify it, it will override the language specified in the codeblock's language hint.

Example

coloration

You can also provide your code with a public hastebin or Github gist link (useful if it's longer than 2,000 characters); ending your command with link=<link>. No spaces around =. The extension of the hastebin isn't taken in account

Example

hastebin

You can also provide your code in a single file uploaded along the message. Note that it cannot exceed 20 ko (that is, 20,000 ASCII characters). Again, the extension or type of the file isn't taken in account.

Example

file

N.B Resolution order to determine the executed code: Check if there is a file, else look for a link= tag at the end, else uses the message the usual way.

--stats is an option which displays more informations about the execution

Example

stats

--wrapped is an option which wraps your code in a minimal main function. It is only available for a few languages, see list command.

Example

wrapped

N.B The --wrapped and --stats options must be placed just after the language, and between spaces.

You can specify compiler flags, command-line-options or arguments adding a separate line starting by the one of these, and after a space what you need between ``

Example

compiler

The same way, you can use multiple inputs, resolved in order

Example

inputs

To prevent spam and allow longer outputs, if the output exceeds 2000 characters or 40 lines, it will not be sent in the chat, and instead the bot will generate a new hastebin containing the output, and give it to you.

Example

spam

reference

Returns element reference from given language

Usage: do reference <language> <query>

  • is the language you wish to search
  • is what you wish to search for

Aliases: ref

Example

html5

There are many references available, see list command.

documentation

Search for related links in the docs

Usage: do reference <language> <query>

  • is the language you wish to search
  • is what you wish to search for

Aliases: ref

Example

doc

There are many documenattions available, see list command.

man

Returns a page from the (mostly Debian) manual, through man.cx

Usage: do man <page>

  • is the name of the page
Example

man

stack

Queries given StackExchange website and gives you top results

Usage: do stack <siteName> <query>

  • is the name of the website. Case-sensitive
  • is the words you wish to search for
Example

stack

list

Lists available choices for other commands

Usage: do list [topic]

  • [topic] is the optional topic to list. The available topics are listed when topic isn't provided
The topics

list

Example

list_references

Clone this wiki locally