Socket
Socket
Sign inDemoInstall

github.com/sabafly/sabafly-disgo

Package Overview
Dependencies
11
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/sabafly/sabafly-disgo

Package disgo is a collection of packages for interaction with the Discord Bot and OAuth2 API. Package discord is a collection of structs and types of the Discord API. Package bot connects the Gateway/Sharding, HTTPServer, Cache, Rest & Events packages into a single high level client interface. Package gateway is used to connect and interact with the Discord Gateway. Package sharding is used to connect and interact with the Discord Gateway. Package cache provides a generic cache interface for Discord entities. Package httpserver is used to interact with the Discord outgoing webhooks for interactions. Package events provide high level events around the Discord Events. Package rest is used to interact with the Discord REST API. Package webhook provides a high level client interface for interacting with Discord webhooks. Package oauth2 provides a high level client interface for interacting with Discord oauth2. Package voice provides a high level client interface for interacting with Discord voice.


Version published

Readme

Source

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

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.OpenGateway(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 slog for logging.

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:

Libraries for DisGo

  • disgomd is a command utility library that uses struct based approach

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 combination 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

Other Golang Discord Libraries

Troubleshooting

For help feel free to open an issue 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.

Supported by Jetbrains

Jetbrain Open Source Community Support

FAQs

Last updated on 31 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc