go get github.com/immick00/webhookgoImport the package into your project.
import "github.com/immick00/webhookgo"package main
import (
"github.com/immick00/webhookgo"
)
func main() {
hook := webhookgo.NewWebhook("https://discord.com/api/webhooks/...").
SetUsername("This is a username").
SetAvatar("https://cdn.discordapp.com/embed/avatars/0.png")
resp, err := hook.Send("this is a message")
if err != nil {
panic(err)
}
}package main
import (
"time"
"github.com/immick00/webhookgo"
)
func main() {
hook := webhookgo.NewWebhook("https://discord.com/api/webhooks/...").
SetUsername("This is a username").
SetAvatar("https://cdn.discordapp.com/embed/avatars/0.png")
e := webhookgo.NewEmbed().
SetTitle("My title here").
SetAuthor("author", "https://cdn.discordapp.com/embed/avatars/0.png", "https://google.com").
SetURL("https://google.com").
AddField("test", "test value", false).
AddField("test", "this is inline", true).
SetColor(0x00b0f4).
SetDescription("This is a description").
SetImage("https://cdn.discordapp.com/embed/avatars/0.png").
SetFooter("This is a footer", "https://cdn.discordapp.com/embed/avatars/0.png").
SetTimestamp(time.Now())
resp, err := hook.SendEmbed(e)
if err != nil {
panic(err)
}
}