Skip to content

godbolt

Godbolt API Wrapper for Tux Bot.

This module provides integration with the Godbolt API allowing code execution and compilation for various programming languages.

Classes:

Functions:

  • checkresponse

    Check the response from the Godbolt API.

  • sendresponse

    Send the response from the Godbolt API.

  • getlanguages

    Get the languages from the Godbolt API.

  • getcompilers

    Get the compilers from the Godbolt API.

  • getspecificcompiler

    Get a specific compiler from the Godbolt API.

  • getoutput

    Send a POST request to the Godbolt API to get the output of the given code.

  • generateasm

    Generate assembly code from the given code.

Classes

CompilerFilters

Bases: TypedDict

Compiler filters.

Parameters:

  • TypedDict (Compiler filters.) –

    Dictionary of compiler filters.

CompilerOptions

Bases: TypedDict

Compiler options.

Parameters:

  • TypedDict (Compiler options.) –

    Dictionary of compiler options.

Options

Bases: TypedDict

Godbolt API options.

Parameters:

  • TypedDict (Options.) –

    Dictionary of options.

Payload

Bases: TypedDict

Payload for the Godbolt API.

Parameters:

  • TypedDict (Payload.) –

    Dictionary of payload.

Functions

checkresponse async

Python
checkresponse(res: Response) -> str | None

Check the response from the Godbolt API.

Parameters:

  • res (Response) –

    The response from the Godbolt API.

Returns:

  • str | None

    The response from the Godbolt API if successful, otherwise None.

Raises:

sendresponse async

Python
sendresponse(url: str) -> str | None

Send the response from the Godbolt API.

Parameters:

  • url (str) –

    The URL to send the response from.

Returns:

  • str | None

    The response from the Godbolt API if successful, otherwise None.

Raises:

getlanguages async

Python
getlanguages() -> str | None

Get the languages from the Godbolt API.

Returns:

  • str | None

    The languages from the Godbolt API if successful, otherwise None.

getcompilers async

Python
getcompilers() -> str | None

Get the compilers from the Godbolt API.

Returns:

  • str | None

    The compilers from the Godbolt API if successful, otherwise None.

getspecificcompiler async

Python
getspecificcompiler(lang: str) -> str | None

Get a specific compiler from the Godbolt API.

Parameters:

  • lang (str) –

    The language to get the specific compiler for.

Returns:

  • str | None

    The specific compiler from the Godbolt API if successful, otherwise None.

getoutput async

Python
getoutput(code: str, lang: str, compileroptions: str | None = None) -> str | None

Send a POST request to the Godbolt API to get the output of the given code.

Parameters:

  • code (str) –

    The code to compile.

  • lang (str) –

    The language of the code.

  • compileroptions (str | None, default: None ) –

    The compiler options, by default None

Returns:

  • str | None

    The output of the code if successful, otherwise None.

Raises:

generateasm async

Python
generateasm(code: str, lang: str, compileroptions: str | None = None) -> str | None

Generate assembly code from the given code.

Parameters:

  • code (str) –

    The code to generate assembly from.

  • lang (str) –

    The language of the code.

  • compileroptions (str | None, default: None ) –

    The compiler options, by default None

Returns:

  • str | None

    The assembly code if successful, otherwise None.

Raises: