/diff Command

The /diff command allows you to compare two texts and visualize their differences using various comparison modes.

Available Subcommands

Discord: /diff compare

Slack: /diff

Compares two texts and shows the differences between them.

Usage

/diff compare text1: <first text> text2: <second text> mode: <comparison mode>

Options

OptionDescriptionRequiredPlatform
text1First text to compareYesDiscord (parameter), Slack (flag with —text1)
text2Second text to compareYesDiscord (parameter), Slack (flag with —text2)
modeComparison modeYes (Discord), No (Slack - defaults to “word”)Discord (parameter), Slack (flag with —mode)

Comparison Modes

The /diff command supports the following comparison modes:

Line by line, Word by word, Character by character
  1. Line by line - Compares texts line by line, useful for code or structured text
  2. Word by word - Compares texts word by word, good for paragraphs or sentences
  3. Character by character - Compares texts character by character, best for short strings or precise comparison

Example

/diff compare text1: "Hello world!" text2: "Hello there!" mode: Word by word
  Hello
- world!
+ there!

Platform-Specific Implementation

Discord Implementation

  • Uses a /diff compare subcommand structure
  • Commands use Discord’s named parameter system (e.g., text1:, text2:, mode:)
  • Responses appear as embedded messages with color-coding
  • The comparison mode is selected from a dropdown menu with predefined options
  • Results are displayed directly in the channel where the command is used
  • Output uses Discord’s syntax highlighting for diff format (```diff)
  • Includes the word “diff” at the beginning of the output (part of the format)

Slack Implementation

  • Uses a direct command with flags: /diff --text1 --text2 --mode
  • Parameters are specified using the flag system (e.g., --text1, --text2, --mode)
  • The mode parameter is optional and defaults to “word” when not specified
  • Text arguments containing spaces should be enclosed in quotes
  • Responses are shown with formatted blocks displaying the result and related information
  • The diff is displayed using a standard code block without the diff syntax highlighting
  • Results use the same format symbols (’+’, ’-’, ’ ’) but in a plain code block
  • The word “diff” is removed from the output for cleaner presentation

Output Format

The diff output uses the following conventions:

  • Lines starting with + indicate content added in the second text
  • Lines starting with - indicate content removed from the first text
  • Lines starting with spaces indicate unchanged content

The results display includes:

  • A summary of changes (added, removed, unchanged)
  • A formatted diff visualization in a code block
  • Information about the comparison mode used

Use Cases

  • Compare code snippets or configuration files
  • Identify changes between versions of text
  • Debug differences in expected vs. actual outputs
  • Analyze text modifications
  • Check for plagiarism or text similarity

Notes

  • Very long text inputs may be truncated in the comparison (max 1000 characters)
  • The output is limited to 1000 characters to fit within message constraints
  • The diff algorithm uses a simple implementation of the longest common subsequence algorithm