slirc

package module
v0.0.0-...-4629a29 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: BSD-2-Clause Imports: 8 Imported by: 0

README

slirc

Build Status

Slirc links an IRC and a Slack channel.

Example Usage

NewBridge has the following signature:

func NewBridge(conf *slirc.Config) (bridge *Bridge)
Example with IRC authentication
package main

import (
		"github.com/simonkern/slirc"
		
		ircc "github.com/fluffle/goirc/client"
)

// Example with IRC Authentication
// Slack Chan without "#"-prefix
func main() {

	postConnect := func(ic *ircc.Conn, c *slirc.Config) {
		log.Println("IRC PostConnect Action")
		<-time.After(5 * time.Second)
		log.Println("Authenticating with Nickserv")
		ic.Privmsg("NickServ", "IDENTIFY BotNick Password")
		<-time.After(3 * time.Second)
	}

	conf := &slirc.Config{
		SlackBotToken:  "xoxb-0123456789-012345678901-5abCdefGhIjkLmN2OpqRSTuV",
		SlackUserToken: "xoxp-0123456789-012345678901-012345678901-2abcd3e45678901234fg5678901234hi",
		SlackChan:      "slackChan", //without # prefix

		IRCServer: "irc.freenode.net",
		IRCChan:   "#ircChanToLink",
		IRCNick:   "IRCNickname",
		IRCSSL:    true,
		IRCPostConnect: postConnect,
	}

	slirc.NewBridge(conf)

	select {}
}
Example without IRC authentication
package main

import (
		"github.com/simonkern/slirc"
		
		ircc "github.com/fluffle/goirc/client"
)

// Example without IRC Authentication
// Slack Chan without "#"-prefix
func main() {
	
	conf := &slirc.Config{
		SlackBotToken:  "xoxb-0123456789-012345678901-5abCdefGhIjkLmN2OpqRSTuV",
		SlackUserToken: "xoxp-0123456789-012345678901-012345678901-2abcd3e45678901234fg5678901234hi",
		SlackChan:      "slackChan", //without # prefix

		IRCServer: "irc.freenode.net",
		IRCChan:   "#ircChanToLink",
		IRCNick:   "IRCNickname",
		IRCSSL:    true,
		IRCPostConnect: nil,
	}

	slirc.NewBridge(conf)

	select {}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bridge

type Bridge struct {
	SlackChan string
	IRCChan   string
	// contains filtered or unexported fields
}

Bridge links an irc and a slack channel

func NewBridge

func NewBridge(c *Config) (bridge *Bridge)

NewBridge instantiates a Bridge object and sets up the required irc and slack clients

type Config

type Config struct {
	SlackBotToken  string
	SlackUserToken string
	SlackChan      string

	IRCServer      string
	IRCChan        string
	IRCNick        string
	IRCSSL         bool
	IRCPostConnect func(ic *ircc.Conn, c *Config)
}

type IRCAuth

type IRCAuth struct {
	Target string
	Msg    string
}

IRCAuth stores authentification target and the message that needs to be send in order to auth e.g. "NickServ" and "IDENTIFY fooBarPassword"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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