disgohook

package module
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2021 License: Apache-2.0 Imports: 5 Imported by: 7

README

disgohook

Go Reference Go Report Go Version License Disgo Version Disgo Discord

DisgoHook is a simple Discord Webhook library written in Go aimed to be easy to use

Getting Started

Installing
go get github.com/DisgoOrg/disgohook
Usage

Import the package into your project.

import "github.com/DisgoOrg/disgohook"

Create a new Webhook by webhook_id/webhook_token. (This WebhookClient should be only created once as it holds important state)

As first param you can optionally pass your own *http.Client and as second parameter you can pass your own logger implementing this interface. This webhook then can be used to send, edit and delete messages

Send Message
webhook, err := disgohook.NewWebhookClientByToken(nil, nil, "webhook_id/webhook_token")

message, err := webhook.SendContent("hello world!")
message, err := webhook.SendEmbeds(api.NewEmbedBuilder().
	SetDescription("hello world!").
	Build(),
)
message, err := webhook.SendMessage(api.NewWebhookMessageCreateBuilder().
	SetContent("hello world!").
	Build(),
)
Edit Message
webhook, err := disgohook.NewWebhookClientByToken(nil, nil, "webhook_id/webhook_token")

message, err := webhook.EditContent("870741249114652722", "hello world!")
message, err := webhook.EditEmbeds("870741249114652722", 
	api.NewEmbedBuilder().
	SetDescription("hello world!").
	Build(),
)
message, err := webhook.EditMessage("870741249114652722", 
	api.NewWebhookMessageUpdateBuilder().
	SetContent("hello world!").
	Build(), 
)
Delete Message
webhook, err := disgohook.NewWebhookClientByToken(nil, nil, "webhook_id/webhook_token")

err := webhook.DeleteMessage("870741249114652722")

Documentation

Documentation is unfinished and can be found under

  • Go Reference
  • Discord Webhook Documentation

Examples

You can find examples under example and dislog

Troubleshooting

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

Contributing

Contributions are welcomed but for bigger changes please first reach out via Discord or create an issue to discuss your intentions and ideas.

License

Distributed under the License . See LICENSE for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWebhookClientByIDToken added in v1.1.1

func NewWebhookClientByIDToken(httpClient *http.Client, logger log.Logger, webhookID api.Snowflake, webhookToken string) (api.WebhookClient, error)

NewWebhookClientByIDToken returns a new api.WebhookClient with the given http.Client, log.Logger, webhookID & webhookToken

func NewWebhookClientByToken added in v1.1.1

func NewWebhookClientByToken(httpClient *http.Client, logger log.Logger, webhookToken string) (api.WebhookClient, error)

NewWebhookClientByToken returns a new api.WebhookClient with the given http.Client, log.Logger & webhookID/webhookToken

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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