pino

package module
v0.0.0-...-8dc7cde Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2016 License: MIT Imports: 10 Imported by: 0

README

pino

Many online communities have moved on to Slack, but many more remain on IRC. pino is a small bridge that allows you to use Slack instead of an IRC client!

When users in the configured IRC channels send messages, you will see them in your Slack. And when you send messages through Slack, IRC users will see it in IRC!

Usage

  1. Make a free Slack account, configure a bot integration, and get the API token.

  2. go get this repository and all of its dependencies:

    $ go get github.com/kennydo/pino
    
  3. Build the binary:

    $ cd $GOPATH/src/github.com/kennydo/pino
    $ go build cmd/pino.go
    
  4. Customize the config to your liking (using your text editor of choice):

    $ cp config-example.yaml config-rizon.yaml
    $ vim config-rizon.yaml
    
  5. Run pino:

    $ ./pino -config config-rizon.yaml
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	IRC            IRCConfig                   `yaml:"IRC"`
	Slack          SlackConfig                 `yaml:"Slack"`
	ChannelMapping map[SlackChannel]IRCChannel `yaml:"ChannelMapping"`
}

Config holds the configuration that Pino expects

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig returns the Config parsed from the given config file path

type IRCChannel

type IRCChannel string

IRCChannel is the name of an IRC channel, like "#CAA"

type IRCChannelKey

type IRCChannelKey string

IRCChannelKey is an optional password for an IRC channel

type IRCConfig

type IRCConfig struct {
	Nickname       string                       `yaml:"Nickname"`
	Name           string                       `yaml:"Name"`
	Server         string                       `yaml:"Server"`
	Password       string                       `yaml:"Password"`
	IsSSL          bool                         `yaml:"IsSSL"`
	Channels       map[IRCChannel]IRCChannelKey `yaml:"Channels"`
	HighlightRules []IRCHighlightRuleConfig     `yaml:"HighlightRules"`
}

IRCConfig define the IRC-specific config

type IRCHighlightRuleConfig

type IRCHighlightRuleConfig struct {
	NickPattern     string `yaml:"NickPattern"`
	MessagePattern  string `yaml:"MessagePattern"`
	ShouldHighlight bool   `yaml:"ShouldHighlight"`
}

IRCHighlightRuleConfig defines when to directly ping the owner on Slack. You can define a nick pattern, a message pattern, or both. If a pattern is not defined, then it is assumed to match all values for that. The first rule that matches is executed. Default is to not highlight.

type Pino

type Pino struct {
	// contains filtered or unexported fields
}

Pino is the central orchestrator

func NewPino

func NewPino(config *Config) (*Pino, error)

NewPino creates a new Pino instance

func (*Pino) Run

func (pino *Pino) Run() error

Run connects to IRC and Slack and runs the main loop

type SlackChannel

type SlackChannel string

SlackChannel is the name of a Slack channel, like "#CAA-on-Slack"

type SlackConfig

type SlackConfig struct {
	Owner    string                  `yaml:"Owner"`
	Token    string                  `yaml:"Token"`
	Channels map[SlackChannel]string `yaml:"Channels"`
}

SlackConfig defines the Slack-specific config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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