message

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2021 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package message handles message definitions and message senders.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inbound

type Inbound struct {
	Channel string
	Content string
	Author  User
}

Inbound received from the chat platform.

type MemorySender

type MemorySender struct {
	Messages []Outbound
}

MemorySender just stores messages in an internal list.

func (*MemorySender) Send

func (m *MemorySender) Send(message Outbound) error

Send the Outbound message to the internal memory store.

func (*MemorySender) SendString

func (m *MemorySender) SendString(channel, message string) error

SendString wraps the message in an Outbound message type and calls Send.

type Outbound

type Outbound struct {
	Channel string
	Message string
	Embed   struct {
		URL         string
		Title       string
		Description string
		Colour      string
		Image       string
		Video       string
		Fields      []struct {
			Name  string
			Value string
		}
	}
}

Outbound sent to the chat platform.

type Sender

type Sender interface {
	// Send the Outbound message. If the message fails to send return an
	// error.
	Send(message Outbound) error

	// SendString sends the message as a basic text message to the given
	// channel. If the message fails to send return an error.
	SendString(channel, message string) error
}

A Sender is able to send a message to a chat platform.

type User

type User struct {
	ID  string
	Bot bool
}

User on the chat platform.

Jump to

Keyboard shortcuts

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