Skip to content

About

Send Discord Webhooks via Go.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

DiscordHook

Go.Dev Go Report Card

This module is made for those, who wants to only use Discord webhooks. If you want more from Discord API, i would suggest you to use disgord.

Where to find webhook ID and token

You can find them in webhook URL https://discord.com/api/webhooks/WEBHOOK_ID_HERE/WEBHOOK_TOKEN_HERE

Examples

package main

import (
    "fmt"

    "github.com/nickname32/discordhook"
)

func main() {
    wa, err := discordhook.NewWebhookAPI(12345678900987654321, "TOKENtoken1234567890asdfghjkl", true, nil)
    if err != nil {
        panic(err)
    }

    wh, err := wa.Get(nil)
    if err != nil {
        panic(err)
    }

    fmt.Println(wh.Name)

    msg, err := wa.Execute(nil, &discordhook.WebhookExecuteParams{
        Content: "Example text",
        Embeds: []*discordhook.Embed{
            {
                Title:       "Hi there",
                Description: "This is description",
            },
        },
    }, nil, "")
    if err != nil {
        panic(err)
    }

    fmt.Println(msg.ID)

    wh, err = wa.Modify(nil, &discordhook.WebhookModifyParams{
        Name: "This is a new default webhook name",
    })
    if err != nil {
        panic(err)
    }

    fmt.Println(wh)

    err = wa.Delete(nil)
    if err != nil {
        panic(err)
    }
}

About

Send Discord Webhooks via Go.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages