ape

package module
v0.0.0-...-9878c8d Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 8 Imported by: 0

README

ape-slack

Slack porting of IRC reaction bot framework ape

Example

package main

import (
  "log"
  "strings"

  "github.com/shogo82148/ape-slack"
)

func main() {
  con := ape.NewConnection("YOUR API TOKEN")

  con.RegisterChannel("#general")

  con.AddAction("piyo", func(e *ape.Event) {
    con.SendMessage("poyo")
  })

  con.AddAction("say", func(e *ape.Event) {
    con.SendMessage(strings.Join(e.Command().Args(), " "))
  })

  con.Loop()
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

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

func (*Command) Args

func (c *Command) Args() []string

func (*Command) Name

func (c *Command) Name() string

type Connection

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

func NewConnection

func NewConnection(token string) *Connection

func (*Connection) AddAction

func (con *Connection) AddAction(command string, callback callbackFunc)

func (*Connection) AddCallback

func (con *Connection) AddCallback(eventCode string, callback callbackFunc) string

func (*Connection) AddDefaultAction

func (con *Connection) AddDefaultAction(callback callbackFunc)

func (*Connection) AddInitAction

func (con *Connection) AddInitAction(callback callbackFunc)

func (*Connection) Channel

func (con *Connection) Channel() string

func (*Connection) Loop

func (con *Connection) Loop()

func (*Connection) RegisterChannel

func (con *Connection) RegisterChannel(channel string)

func (*Connection) SendMessage

func (con *Connection) SendMessage(message string)

type Event

type Event struct {
	Nick string
	// contains filtered or unexported fields
}

func (*Event) Command

func (e *Event) Command() *Command

func (*Event) Message

func (e *Event) Message() string

Jump to

Keyboard shortcuts

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