Commands
Diff Command
Documentation for the /diff command to compare texts and show differences
/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
Options
Option | Description | Required | Platform |
---|---|---|---|
text1 | First text to compare | Yes | Discord (parameter), Slack (flag with —text1) |
text2 | Second text to compare | Yes | Discord (parameter), Slack (flag with —text2) |
mode | Comparison mode | Yes (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 - Compares texts line by line, useful for code or structured text
- Word by word - Compares texts word by word, good for paragraphs or sentences
- Character by character - Compares texts character by character, best for short strings or precise comparison
Example
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