discord

package
v0.0.0-...-2cc726f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

Channel - A text channel inside a server.

func (Channel) String

func (e Channel) String() string

type Client

type Client interface {
	// Guilds - Returns the guilds or servers the discord user or bot
	// is added to.
	Guilds() ([]Guild, error)

	// Channels - Returns the channels inside a a particular
	// guild or server this user or bot is added to.
	Channels(guildID string) ([]Channel, error)

	// Messages - Returns the last "count" of messages for this
	// channel.
	Messages(channelID string, count int) ([]Message, error)

	// SendMessage - To send a message to a channel.
	SendMessage(channelID string, message string) error
}

Client - Custom wrapper to interact with discord API.

func NewClient

func NewClient(config ClientConfig) (Client, error)

NewClient - Gets a new Discord client.

type ClientConfig

type ClientConfig interface {
	// Token - Used to authenticate.
	Token() string

	// IsBot - Used to identify if token belongs to bot.
	IsBot() bool
}

ClientConfig - To configure discord client.

func NewConfig

func NewConfig() (ClientConfig, error)

NewConfig - Provides a new config from environment variables for discord client.

type Guild

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

Guild - A server.

func (Guild) String

func (e Guild) String() string

type Message

type Message struct {
	// Text - Content of the message.
	Text string

	// Sender - Sender of the message.
	Sender string

	// SentAt - Instant this message was sent at.
	SentAt time.Time
}

Message - Represents a text message inside a channel.

func (Message) String

func (m Message) String() string

Jump to

Keyboard shortcuts

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