wumpus

package
v0.0.0-...-e218727 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2018 License: ISC Imports: 5 Imported by: 0

Documentation

Overview

Package wumpus provides lightweight wrappers over Discord's REST and Gateway APIs.

Be warned that the REST wrapper is not intended to be used directly on Discord's REST API; but rather with a REST proxy such as [blaze](https://github.com/yuki-bot/blaze)

This is intentional; since workers are incapable of handling ratelimits themselves, I outsource this behavior directly to the proxy

Note that most of this package will be incomplete abstractions over Discord's API. This is intentional; I am only implementing models as necessary for my bots to function. Should you need a model that is not included here, feel free to fork out or submit a merge request

This is not intended to be a fully functional Discord wrapper - see [discordgo](https://github.com/bwmarrin/discordgo) for that instead

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateMessageArgs

type CreateMessageArgs struct {
	Content string      `json:"content,omitempty"`
	Embed   interface{} `json:"embed,omitempty"`
}

CreateMessageArgs contains additional fields to create a message (TODO)

type Discord

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

Discord wraps the Discord REST API (blaze)

Note: This wrapper does NOT provide rate-limiting, you are expected to be using a proxy ala. blaze which provides consolidated ratelimiting

func NewDiscord

func NewDiscord(baseURL string) *Discord

NewDiscord creates a new Discord wrapper at the given URL

func (*Discord) CreateMessage

func (d *Discord) CreateMessage(channelID Snowflake, args CreateMessageArgs) (*Message, error)

type Event

type Event struct {
	Op   int             `json:"op"`
	Data json.RawMessage `json:"d"`
	Type string          `json:"t"`
}

Event handles a payload from the exchange

type Message

type Message struct {
	ID        Snowflake `json:"id"`
	ChannelID Snowflake `json:"channel_id"`
	GuildID   Snowflake `json:"guild_id"`
	Content   string    `json:"content"`
}

Message handles an incoming message

type Snowflake

type Snowflake string

Snowflake is an ID type for Discord

Jump to

Keyboard shortcuts

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