IRC-Style Commands in Bitchat Android: Complete Command Reference

Bitchat Android supports 14 IRC-style commands accessed via slash prefixes, including messaging, moderation, channel management, and playful interactions like /hug and /slap.

The Bitchat Android messaging client implements a lightweight IRC-style command interpreter that lets users control the app directly from the chat input. All commands begin with / and are processed through a centralized CommandProcessor.kt class. This article covers every supported command, their aliases, arguments, and implementation details from the permissionlesstech/bitchat-android source code.

Command Reference: Complete List of IRC-Style Commands

The command registry lives in CommandProcessor.kt (lines 23-33), where a static list of CommandSuggestion objects defines every built-in command. Below is the complete reference derived directly from the source.

Messaging and Communication Commands

Command Alias Arguments Description
/j /join – <channel> Join an existing geohash channel or create a new one
/m /msg /w equiv. for DM <nickname> [message] Send a private direct message
/w – – Show who is currently online in the channel

The /join command is the primary entry point for channel participation. If the specified channel does not exist, Bitchat automatically creates it. The /msg command (aliased as /m) routes messages outside normal channel broadcasts through the mesh service's direct message packet builder.

Moderation and User Management Commands

Command Arguments Description
/block [nickname] Block a peer or list all blocked peers
/unblock <nickname> Remove a peer from the block list

The /block command operates in two modes: with a nickname, it adds that peer to the local block list; without arguments, it displays all currently blocked users. The handleBlockCommand function updates the local block list and immediately prevents further message processing from the blocked peer.

Channel Administration Commands

These commands are channel-specific and only function when issued within an active channel context:

Command Arguments Description
/pass [password] Change the password of a protected channel
/save – Persist channel messages locally
/transfer <nickname> Transfer channel ownership to another peer

Implementation details for channel-specific extensions appear around lines 508-511 in CommandProcessor.kt. The /transfer command requires ownership verification before invoking the ownership transfer protocol.

Social and Utility Commands

Command Arguments Description
/hug <nickname> Send a warm "hug" reaction
/slap <nickname> Playfully "slap" a peer (trout-themed)
/pay <token> [public] Send a Cashu e-cash token (optionally public)
/channels – Show every discovered geohash channel
/clear – Clear the current chat view

The /pay command integrates Cashu e-cash token transfers directly into chat. The optional public flag broadcasts the token to all channel participants rather than a single recipient.

How Commands Are Processed: Implementation Architecture

The processCommand method in CommandProcessor.kt (around lines 45-46) handles all command routing. The execution flow follows this pattern:

  1. Detect leading / character
  2. Tokenize the input string
  3. Match the first token against the command registry
  4. Dispatch to dedicated handlers (e.g., handleJoinCommand, handlePayCommand)
  5. Return error feedback for unknown commands
// Command processing entry point as implemented
val message = "/msg alice Hi Alice!"
viewModel.sendMessage(message)   // ChatViewModel forwards to CommandProcessor

If a command is unknown, the UI displays a helpful "unknown command" notice rather than failing silently.

Command Autocomplete and UI Integration

The command system powers Bitchat's autocomplete and suggestion UI components. ChatViewModel maintains a StateFlow<List<CommandSuggestion>> that updates dynamically as the user types. The composable InputComponents.kt renders these suggestions with distinct visual highlighting for slash-commands.

// UI observes suggestions automatically
val suggestions = viewModel.commandSuggestions.collectAsState()

When a user types /s, the suggestion list filters to /slap and /save. Selecting a suggestion populates the input field with the command plus trailing space, ready for arguments.

Practical Code Examples

Joining or Creating a Channel

val joinCmd = "/join #travel"
viewModel.sendMessage(joinCmd)   // CommandProcessor calls handleJoinCommand

Sending a Private Message

viewModel.sendMessage("/m bob Meeting at noon")
// Equivalent to: /msg bob Meeting at noon

Blocking a Peer

viewModel.sendMessage("/block spammer")
// handleBlockCommand updates local block list

Listing Online Users

viewModel.sendMessage("/w")   // Returns current channel presence

Key Source Files

File Purpose
app/src/main/java/com/bitchat/android/ui/CommandProcessor.kt Central command registry, parsing, and handler dispatch
app/src/main/java/com/bitchat/android/ui/ChatViewModel.kt Holds CommandProcessor instance, exposes StateFlow for UI
app/src/main/java/com/bitchat/android/ui/InputComponents.kt Renders message input with slash-command visual distinction
app/src/main/java/com/bitchat/android/ui/ChatScreen.kt Displays suggestion list and handles command selection
app/src/test/java/com/bitchat/android/ui/CommandProcessorTest.kt Unit tests for each command's behavior and edge cases

Summary

  • 14 IRC-style commands are implemented in Bitchat Android, ranging from basic messaging (/msg, /join) to channel administration (/transfer, /pass) and playful interactions (/hug, /slap)

  • Dual aliases exist for common operations: /j and /join for channel access; /m and /msg for direct messaging

  • CommandProcessor.kt serves as the single source of truth for command definitions, parsing logic, and handler dispatch

  • Real-time autocomplete is powered by StateFlow observation in ChatViewModel, with visual feedback in Jetpack Compose UI components

  • Cashu e-cash integration via /pay enables token transfers within chat conversations

Frequently Asked Questions

How do I send a private message in Bitchat Android?

Use the /msg command (or its alias /m) followed by a nickname and optional message: /msg alice Hello. If no message is provided, the UI may open a dedicated direct message interface depending on your client version.

What happens if I type an unknown command?

The processCommand method returns an "unknown command" notice that displays inline in the chat interface. The suggestion system helps prevent this by filtering valid commands as you type.

Are IRC-style commands in Bitchat Android case-sensitive?

Commands are processed as lowercase. /JOIN, /Join, and /join all resolve identically through the tokenization logic in CommandProcessor.kt.

Can I create custom commands or aliases?

The current implementation in permissionlesstech/bitchat-android uses a static command list defined in CommandProcessor.kt (lines 23-33). Custom commands require modifying the source and rebuilding the application.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →