Skip to content

rotaria-smp/discordwebhook

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Webhook

This package provides a super simple interface to send discord messages through webhooks in golang.

Guide

  1. Create a Message object from types.go. Compare with Discord Webhook API docs.
  2. Call sendMessage with the webhook URL and Message object.

Installation

go get github.com/rotaria-smp/discordwebhook

Example

Below is the most basic example on how to send a message. For a more advanced message structure see the structs in types.go and https://birdie0.github.io/discord-webhooks-guide/discord_webhook.html

package main

import "github.com/rotaria-smp/discordwebhook"

func main() {
   var username = "BotUser"
   var content = "This is a test message"
   var url = "https://discord.com/api/webhooks/..."

   message := discordwebhook.Message{
       Username: &username,
       Content: &content,
   }

   err := discordwebhook.SendMessage(url, message)
   if err != nil {
       log.Fatal(err)
   }
}

TODO

  • Tests

About

Super simple interface to send discord messages through webhooks in golang

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%