discordance

package module
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2022 License: MIT Imports: 8 Imported by: 2

README

Discordance

Build Issues Pull Requests Go Doc License

A wrapper around discordgo for bots.

Documentation

Overview

Package discordance allows connection to discord and registration of various handlers for a bot interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	*discordgo.Session
	// contains filtered or unexported fields
}

Connection to a discord server.

func Connect

func Connect(settings config.Discord) (*Connection, error)

Connect to discord using the given config.

func (*Connection) Commands

func (c *Connection) Commands(server string, commands ...*command.Definition)

Commands to register on the given server.

func (*Connection) Listen

func (c *Connection) Listen()

Listen for events. Listen blocks until SIGINT is received.

func (*Connection) Message

func (c *Connection) Message(handlers ...message.Handler)

Message handlers to register on the connection.

func (*Connection) Unregister

func (c *Connection) Unregister(server string)

Unregister commands on this server.

type User added in v0.0.7

type User struct {
	ID     string
	Name   string
	Avatar string
}

User defines basic details on a user.

func (*User) Author added in v0.0.8

func (u *User) Author() *discordgo.MessageEmbedAuthor

Author returns the user as a message embed author.

func (*User) Populate added in v0.0.7

func (u *User) Populate(s *discordgo.Session) error

Populate a User from the given session. The User ID must be set as this is used to retrieve the user data. If an error is returned the User struct remains unmodified.

Directories

Path Synopsis
Package command defines application commands and handlers for the bot.
Package command defines application commands and handlers for the bot.
Package config provides goconfigure compatible configuration blocks for a discordance bot.
Package config provides goconfigure compatible configuration blocks for a discordance bot.
Package message handles replies and message events.
Package message handles replies and message events.
Package snowflake provides functions for acting on Discord snowflakes.
Package snowflake provides functions for acting on Discord snowflakes.

Jump to

Keyboard shortcuts

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