CodeCord.xyz
docsCommandsFormatter Commands

Formatter Commands

CodeCord provides code formatting capabilities through both slash commands and context menu commands. The formatter helps maintain consistent code style and readability in your discussions.

Slash Command

Format Message

/format [messageId] [language]

Format code in a specific message.

Parameters:

  • messageId - ID of the message containing the code to format
  • language (optional) - Programming language for formatting. If not provided, uses server default setting which can be changed in the CodeCord dashboard or attemps to auto-detect the language

Language Detection

The formatter handles language selection in this order:

  1. Language specified in the command
  2. Server default language (set in Dashboard)
  3. Auto-detection

Context Menu Command

Format Code Block

Right-click any message containing code and select “Format Code” from the Apps menu. This will:

  1. Format all code blocks in the message
  2. Use language specified in the code block (if any)
  3. Fall back to server default or auto-detection

Example code block with language:

```python
def hello():
    print("Hello")
```

Language Settings

Configure default formatting behavior in the CodeCord Dashboard:

  • Set default language
  • Enable/disable auto-detection

Supported Languages

The formatter supports many popular languages including:

  • JavaScript/TypeScript
  • Python
  • C#
  • Java
  • And many more…

Examples

Using Slash Command

# Format with specific language
/format 123456789 python
 
# Format using server default/auto
/format 123456789

Using Context Menu

  1. Right-click message with code
  2. Apps → Format Code
  3. Code is formatted based on:
    • Code block language (if specified)
    • Server default settings
    • Auto-detection (if enabled)

Notes

  • Code should be in code blocks for best results
  • Auto-detection works best with clear language patterns
  • Context menu is the quickest way to format visible messages
  • Use slash command to format messages by ID or in other channels