message

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package message handles replies and message events.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoChannel = errors.New("no channel set for outbound message")

ErrNoChannel is returned if no channel is set on the Sender or Outbound message to be sent.

Functions

func Send

func Send(s Sender, message Outbound) error

Send the Outbound message.

Types

type Dispatcher

type Dispatcher []Handler

Dispatcher for inbound messages to Handlers.

func (*Dispatcher) Dispatch

func (d *Dispatcher) Dispatch(s *discordgo.Session, m *discordgo.MessageCreate)

Dispatch an inbound message to the registered handlers.

type Handler

type Handler func(m Inbound, s Sender)

Handler used to process inbound messages.

type Inbound

type Inbound struct {
	Channel string
	Content string
	Author  User
}

Inbound message received from Discord.

type Outbound

type Outbound struct {
	Channel string
	Message string
	Embed   *discordgo.MessageEmbed
}

Outbound message sent to discord.

func (Outbound) Translate

func (o Outbound) Translate() *discordgo.MessageSend

Translate and Outbound message to one used bed discordgo.

type Sender

type Sender interface {
	ChannelMessageSendComplex(channelID string,
		data *discordgo.MessageSend) (st *discordgo.Message, err error)
}

Sender used to send messages to the underlying 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