Skip to content

A CLI utility to allow pipe to stdin, and sending toa discord channel.

Notifications You must be signed in to change notification settings

mattjoyce/disgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Disgo

A simple CLI tool for sending messages to Discord channels from the command line. Perfect for integrating Discord notifications into scripts and pipelines.

Features

  • Pipe text content directly to Discord channels
  • Support for configuration files
  • Thread creation for long messages
  • Message handling modes for large content
  • Debug logging
  • Passthrough mode for testing

Installation

go install github.com/mattjoyce/disgo@latest

Or clone and build:

git clone https://github.com/mattjoyce/disgo.git
cd disgo
go build -o disgo

Setup

  1. Create a Discord bot and get its token (Discord Developer Portal)
  2. Get your channel ID (Enable Developer Mode in Discord, right-click channel, Copy ID)
  3. Create or edit the config file at ~/.config/disgo/default.yaml:
token: "your-bot-token"
channel_id: "your-channel-id"
username: "disgo-bot"

Usage

Basic usage:

# Send a message
echo "Hello Discord!" | disgo

# Send with debug information
echo "Hello Discord!" | disgo --debug

# Use passthrough mode for testing
echo "Test message" | disgo --passthrough

# Create a thread for long content
cat longfile.txt | disgo --thread "Long Content Thread"

# Use a different config file
echo "Using alt config" | disgo --config test1

Configuration

Default configuration location: ~/.config/disgo/default.yaml

token: ""                  # Discord bot token
channel_id: ""            # Target channel ID
server_id: ""             # Server ID (optional)
username: "disgo-bot"     # Bot username
debug: false              # Enable debug logging
max_message_size: 2000    # Maximum message size
message_mode: "serialize" # Message handling mode (serialize|truncate)
thread_name: ""          # Default thread name (optional)

Multiple configuration files can be used by placing them in the ~/.config/disgo/ directory with a .yaml extension.

Message Handling

Long messages (>2000 characters) are handled in two ways:

  • serialize: Splits the message into multiple parts (default)
  • truncate: Cuts off at the maximum length

When using threads, the first message will be a thread notification, and the content will be posted within the thread.

Command Line Options

  -c, --config string       Config name to use (without .yaml extension) (default "default")
      --debug              Enable debug logging
      --max-size int       Maximum message size (default 2000)
      --message-mode string Message handling mode (serialize|truncate) (default "serialize")
      --passthrough        Echo stdin to stdout
      --thread string      Create thread with given name for messages

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT License

About

A CLI utility to allow pipe to stdin, and sending toa discord channel.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages