CodeCord.xyz
docsCommandsCode Snippet Commands

Snippet Command

The /snippet command is a tool for sharing and collaborating on code within your Discord server. Whether you want to quickly share a code snippet or collaborate with others through suggestions and improvements, this command has you covered.

Basic Usage

/snippet

Opens an interactive modal where you can:

  1. Select the programming language for formatting and syntax highlighting
  2. Paste your code
  3. Optionally add a question or description

Modal Fields:

  • Question (optional) - Any context about your code
  • Code - Your code snippet
  • Language - Programming language for syntax highlighting

Features

Simple Code Sharing

  • Clean, syntax-highlighted code blocks
  • Support for multiple programming languages
  • Automatic code formatting (when enabled)
  • Perfect for quick code sharing and questions

Collaboration Features

  • Suggest improvements to any shared code
  • View and compare different versions
  • See exactly what changed with diff highlighting
  • Track who suggested what and when

Examples

Quick Code Share

/snippet
# Modal opens:
Code: 
function hello(name: string): string {
    return `Hello, ${name}!`;
}
Language: auto

Collaborative Features

  1. Suggesting Changes

    • Click “Suggest Changes” on any snippet
    • Edit the code
    • Add a description of your changes
    • Creates a new version automatically
  2. Viewing Changes

    • Use “Show Changes” to see differences
    • Green highlights show added code
    • Red highlights show removed code
    • Navigate between versions with Previous/Next

Settings

Configure in Dashboard:

  • Default programming language
  • Auto-format code submissions

Tips

  • For quick shares, just paste your code and write auto for programming language and go
  • Add descriptions to your changes to help others understand your suggestions
  • Use the diff view to track modifications
  • Iterate on code together through suggestions