piper

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README


Piper
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

screenshot

Key Features

  • Pipe std.in or std.out to Discord
  • CLI application and Golang package support
  • Easy installation
  • Cross platform

How To Use

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 default config file location is ~/.piper/config.yaml. The following settings are available:

  • token - Discord bot token
  • channel - 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  

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pipe

type Pipe struct {
	Token     string
	ChannelID string
	Discord   *discordgo.Session
	// contains filtered or unexported fields
}

func NewPipe

func NewPipe(token string, channelID string) (*Pipe, error)

func (*Pipe) Start

func (c *Pipe) Start() error

func (*Pipe) Stop

func (c *Pipe) Stop() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL