discordbot

package module
v0.0.0-...-8c2de32 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2017 License: MIT Imports: 5 Imported by: 0

README

discordbot

A minimal Discord bot programming library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiscordBot

type DiscordBot interface {
	User() User
	Close()
	OnMessage(MessageHandler)
	SendMessage(channelID string, content string) error
}

/ Represents a Discord bot user.

func New

func New(apiKey string, ui UserInterface) (DiscordBot, error)

/ Creates a new DiscordBot using the specific UserInterface

type Message

type Message struct {
	User        User
	Content     string
	ChannelID   string
	ChannelName string
	IsDM        bool
}

type MessageHandler

type MessageHandler func(DiscordBot, *Message)

/ Adapter for message handler fns.

type User

type User struct {
	ID string
}

type UserInterface

type UserInterface int

/ Specifies how the bot interacts with users. / / Terminal: Messages are sent and recieved on stdout/stdin. / Client: Messages are sent and recieved through the discord client.

const (
	Terminal UserInterface = iota
	Client
)

Jump to

Keyboard shortcuts

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