New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/nextep-community/gocord

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/nextep-community/gocord

  • v0.0.0-20241201155920-9e7f3a9b9a83
  • Source
  • Go
  • Socket score

Version published
Created
Source

License. Go Reference Go Report Go Version

Gocord

Gocord is a Go library forked from DisGo, that is a Discord API wrapper written in Go.

Why fork?: This project was created for internal use within the bot Digo, which was developed by Nextep to study and enhance the team's knowledge of Go. For this reason, we wanted maximum control and to ensure the library is updated as quickly as possible with the latest Discord changes. However, we didn’t want to start from scratch.

Stability

The public API of Gocord 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 Gocord should be increased and with that breaking changes between non-major versions should be held to a minimum.

Documentation

Documentation is wip and can be found under

  • Go Reference
  • Discord Documentation
  • Examples

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

Features

Missing Features

Getting Started

Installing

$ go get github.com/nextep-community/gocord

Building a gocord Instance

Build a bot client to interact with the Discord API

package main

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

	"github.com/nextep-community/gocord"
	"github.com/nextep-community/gocord/bot"
	"github.com/nextep-community/gocord/events"
	"github.com/nextep-community/gocord/gateway"
)

func main() {
	client, err := gocord.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
}

Logging

gocord uses slog for logging.

Examples

You can find examples here

There is also a bot template with commands & db here

Other interesting projects

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

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

Other Golang Discord Libraries

Troubleshooting

TODO

Contributing

TODO

Special Thanks

We would like to thank the DisGo team and community.

License

See LICENSE for more information.

License.

FAQs

Package last updated on 01 Dec 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc