slacter

package module
v0.0.0-...-001bf69 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2018 License: MIT Imports: 5 Imported by: 0

README

Slacter

slacter is a simple slack client that implements io.Writer.

Installation

$ go get github.com/yukpiz/slacter

Usage

package main

import (
	"log"

	"github.com/yukpiz/slacter"
)

func main() {
	writer := slacter.New(&slacter.Config{
		Token:    "{{YOUR_SLACK_AUTH_TOKEN}}",
		Channel:  "test-channel",
		UserName: "yukpiz",
		IconURL:  "https://i.gyazo.com/30ff8e8938efed0382400961f3c59304.jpg",
	})

	logger := log.New(writer, "", log.Ldate|log.Ltime)

	logger.Println("Hello!")
	logger.Println("こんにちは!")
	logger.Println("안녕하세요!")
	logger.Println("您好!")
}

Result

How to generate slack's token.
https://get.slack.help/hc/en-us/articles/215770388-Create-and-regenerate-API-tokens

Author

Yuuki Zayasu(yukpiz)

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Token    string
	Channel  string
	UserName string
	IconURL  string
}

type SlackResponse

type SlackResponse struct {
	Ok    bool   `json:"ok"`
	Error string `json:"error"`
}

type Slacter

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

func New

func New(config *Config) *Slacter

func (*Slacter) Write

func (s *Slacter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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