discord

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2025 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package discord

This package provides programatic access to discord messages integrated with GoMud.

References: https://leovoel.github.io/embed-visualizer/ https://birdie0.github.io/discord-webhooks-guide/discord_webhook.html https://gist.github.com/rxaviers/7360908

Index

Constants

View Source
const (
	RequestFailureBackoffSeconds = 30
)

Variables

View Source
var (
	WebhookUrl string
)

Functions

func HandleAuctionUpdate

func HandleAuctionUpdate(e events.Event) events.ListenerReturn

func HandleBroadcast

func HandleBroadcast(e events.Event) events.ListenerReturn

func HandleDeath

func HandleDeath(e events.Event) events.ListenerReturn

func HandleLevelup

func HandleLevelup(e events.Event) events.ListenerReturn

func HandleLogs

func HandleLogs(e events.Event) events.ListenerReturn

func HandlePlayerDespawn

func HandlePlayerDespawn(e events.Event) events.ListenerReturn

Player leaves the world event

func HandlePlayerSpawn

func HandlePlayerSpawn(e events.Event) events.ListenerReturn

Player enters the world event

func Init

func Init(webhookUrl string)

Initializes and sets the webhook so we can send messages to discord and registers listeners to listen for events

func SendMessage

func SendMessage(message string)

Sends a simple message to discord

func SendPayload

func SendPayload(payload webHookPayload)

Sends a simple message to discord

func SendRichMessage

func SendRichMessage(message string, color Color)

Sends an embed message to discord which includes a colored bar to the left hexColor should be specified as a string in this format "#000000"

Types

type Color

type Color int
const (
	Default           Color = 0        // #000000
	Aqua              Color = 1752220  // #1ABC9C
	DarkAqua          Color = 1146986  // #11806A
	Green             Color = 5763719  // #57F287
	DarkGreen         Color = 2067276  // #1F8B4C
	Blue              Color = 3447003  // #3498DB
	DarkBlue          Color = 2123412  // #206694
	Purple            Color = 10181046 // #9B59B6
	DarkPurple        Color = 7419530  // #71368A
	LuminousVividPink Color = 15277667 // #E91E63
	DarkVividPink     Color = 11342935 // #AD1457
	Gold              Color = 15844367 // #F1C40F
	DarkGold          Color = 12745742 // #C27C0E
	Orange            Color = 15105570 // #E67E22
	DarkOrange        Color = 11027200 // #A84300
	Red               Color = 15548997 // #ED4245
	DarkRed           Color = 10038562 // #992D22
	Grey              Color = 9807270  // #95A5A6
	DarkGrey          Color = 9936031  // #979C9F
	DarkerGrey        Color = 8359053  // #7F8C8D
	LightGrey         Color = 12370112 // #BCC0C0
	Navy              Color = 3426654  // #34495E
	DarkNavy          Color = 2899536  // #2C3E50
	Yellow            Color = 16776960 // #FFFF00
)

Jump to

Keyboard shortcuts

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