Piper
A tool to pipe std.in or std.out to Discord, available as a CLI application or a Golang package.
Key Features •
How To Use •
CLI Options •
Config File Settings •
Download

Key Features
- Pipe std.in or std.out to Discord
- CLI application and Golang package support
- Easy installation
- Cross platform
How To Use
Creating a Discord App
To use Piper with Discord, you'll need to create a Discord app and obtain a bot token. Follow these steps:
-
Go to the Discord Developer Portal:
-
Create a New Application:
- Click on "New Application".
- Give your application a name and click "Create".
-
Create a Bot:
- Navigate to the "Bot" tab on the left sidebar.
- Click "Add Bot" and confirm by clicking "Yes, do it!".
- Keep the token safe by clicking "Copy" under the "TOKEN" section. You will need this token for Piper.
-
Invite the Bot to Your Server:
- Go to the "OAuth2" tab on the left sidebar.
- Under "OAuth2 URL Generator", select "bot" in the "SCOPES" section.
- In the "BOT PERMISSIONS" section, select "Send Messages" and "Manage Messages".
- Copy the generated URL and paste it into your browser. Select the server you want to invite the bot to and authorize the bot.
-
Get the Channel ID:
- Open Discord and go to "User Settings" > "Advanced" > enable "Developer Mode".
- Right-click on the channel where you want the messages to be sent and select "Copy ID".
Now you have everything you need to configure Piper with your Discord bot.
CLI Application
To use Piper as a CLI application, install it using the following command:
curl -sSfL https://raw.githubusercontent.com/AndrewVota/piper/main/install.sh | sh
Then, you can run the application from your terminal:
# Pipe std.in to Discord
# You can create a config file to forego arguments
# Default location to create it: $HOME/.piper.yaml
$ echo "Hello, Discord!" | piper --token "your_secret_token" --channelID "your_channel_id"
Golang Package
To use Piper as a Golang package, install it using:
go get github.com/andrewvota/piper
Then, import and use it in your Golang code:
package main
import (
"github.com/andrewvota/piper"
)
func main() {
pipe, err := piper.NewPipe("your_secret_token", "your_channel_id")
if err != nil {
fmt.Printf("error creating pipe: %s", err)
}
err = pipe.Start()
if err != nil {
fmt.Printf("error starting piper: %s", err)
}
defer pipe.Stop()
// Rest of your program...
fmt.Println("Hello, World.") // This will be sent to discord!
}
CLI Options
The Piper CLI supports the following options:
--token - Discord bot token
--channelID - Discord channel ID
--config - Config file (default is $HOME/.piper.yaml)
Config File Settings
You can configure Piper using a config file. The config file will be searched for at ~/.piper/config.yaml. The following settings are available:
token - Discord bot token
channelID - Discord channel ID
Example config file:
token: your_secret_token
channel: your_channel_id
Download
You can download the latest version of Piper from the releases page.
License
MIT
Website Vota.cc ·
GitHub @AndrewVota ·
LinkedIn @AndrewVota