disgo

package module
v0.13.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: Apache-2.0 Imports: 7 Imported by: 77

README

Go Reference Go Report Go Version License DisGo Version DisGo Discord

discord gopher

DisGo

DisGo is a Discord API wrapper written in Golang aimed to be consistent, modular, customizable and higher level than other Discord API wrappers.

Summary

  1. Stability
  2. Features
  3. Missing Features
  4. Getting Started
  5. Documentation
  6. Examples
  7. Other interesting Projects to look at
  8. Other Golang Discord Libraries
  9. Troubleshooting
  10. Contributing
  11. License
Stability

The public API of DisGo is mostly stable at this point in time. Smaller breaking changes can happen before the v1 is released.

After v1 is released breaking changes may only happen if the Discord API requires them. They tend to break their released API versions now and then. In general for every new Discord APi version the major version of DisGo should be increased and with that breaking changes between non-major versions should be held to a minimum.

Features
Missing Features

Getting Started

Installing
go get github.com/disgoorg/disgo
Building a DisGo Instance

Build a bot client to interact with the discord api

package main

import (
	"context"
	"os"
	"os/signal"
	"syscall"

	"github.com/disgoorg/disgo"
	"github.com/disgoorg/disgo/bot"
	"github.com/disgoorg/disgo/events"
	"github.com/disgoorg/disgo/gateway"
)

func main() {
	client, err := disgo.New("token",
		// set gateway options
		bot.WithGatewayConfigOpts(
			// set enabled intents
			gateway.WithIntents(
				gateway.IntentGuilds,
				gateway.IntentGuildMessages,
				gateway.IntentDirectMessages,
			),
		),
		// add event listeners
		bot.WithEventListenerFunc(func(e *events.MessageCreate) {
			// event code here
		}),
	)
	if err != nil {
		panic(err)
	}
	// connect to the gateway
	if err = client.ConnectGateway(context.TODO()); err != nil {
		panic(err)
	}

	s := make(chan os.Signal, 1)
	signal.Notify(s, syscall.SIGINT, syscall.SIGTERM)
	<-s
}
Full Ping Pong Example

A full Ping Pong example can also be found here

Logging

DisGo uses our own small logging interface which you can use with most other logging libraries. This lib also comes with a default logger which is based on the standard log package.

Documentation

Documentation is wip and can be found under

  • Go Reference
  • Discord Documentation

GitHub Wiki is currently under construction. We appreciate help here.

Examples

You can find examples here

There is also a bot template with commands & db here

or in these projects:

Other interesting Projects to look at

Is a standalone audio sending node based on Lavaplayer and JDA-Audio. Which allows for sending audio without it ever reaching any of your shards. Lavalink can be used in combinatio with DisGolink for music Bots

Being used in production by FredBoat, Dyno, LewdBot, and more.

Is a Lavalink-Client which can be used to communicate with LavaLink to play/search tracks

DisLog

Is a Discord webhook logger hook for logrus

Other Golang Discord Libraries

Troubleshooting

For help feel free to open an issues or reach out on Discord

Contributing

Contributions are welcomed but for bigger changes we recommend first reaching out via Discord or create an issue to discuss your problems, intentions and ideas.

License

Distributed under the License. See LICENSE for more information.

Documentation

Overview

Package disgo is a collection of packages to interaction with the Discord Bot and OAuth2 API.

Discord

Package discord is a collection of structs and types of the Discord API.

Bot

Package bot connects the Gateway/Sharding, HTTPServer, Cache, Rest & Events packages into a single high level client interface.

Gateway

Package gateway is used to connect and interact with the Discord Gateway.

Sharding

Package sharding is used to connect and interact with the Discord Gateway.

Cache

Package cache provides a generic cache interface for Discord entities.

HTTPServer

Package httpserver is used to interact with the Discord outgoing webhooks for interactions.

Events

Package events provide high level events around the Discord Events.

Rest

Package rest is used to interaction with the Discord REST API.

JSON

Package json provides configurable interfaces for JSON encoding and decoding.

Webhook

Package webhook provides a high level client interface for interacting with Discord webhooks.

OAuth2

Package oauth2 provides a high level client interface for interacting with Discord oauth2.

Index

Constants

View Source
const (
	// Name is the library name
	Name = "disgo"

	// GitHub is a link to the libraries GitHub repository
	GitHub = "https://github.com/disgoorg/" + Name
)

Variables

View Source
var (
	// Version is the currently used version of DisGo
	Version = getVersion()

	// OS is the currently used OS
	OS = getOS()
)

Functions

func New

func New(token string, opts ...bot.ConfigOpt) (bot.Client, error)

New creates a new bot.Client with the provided token & bot.ConfigOpt(s)

Types

This section is empty.

Directories

Path Synopsis
_examples
audio module
internal
insecurerandstr
Package insecurerandstr is not secure
Package insecurerandstr is not secure
Package json provides configurable interfaces for JSON encoding and decoding.
Package json provides configurable interfaces for JSON encoding and decoding.

Jump to

Keyboard shortcuts

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