https://github.com/codemicro/pkwebhooktranslator
Golang library to translate PluralKit webhook dispatch events to Discord message embeds
https://github.com/codemicro/pkwebhooktranslator
Last synced: about 2 hours ago
JSON representation
Golang library to translate PluralKit webhook dispatch events to Discord message embeds
- Host: GitHub
- URL: https://github.com/codemicro/pkwebhooktranslator
- Owner: codemicro
- License: mit
- Created: 2021-11-22T20:21:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-11-29T18:24:03.000Z (over 4 years ago)
- Last Synced: 2025-12-19T20:24:35.731Z (5 months ago)
- Language: Go
- Homepage:
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pkWebhookTranslator
*Golang library to translate [PluralKit](https://www.pluralkit.me) webhook dispatch events to Discord message embeds*
---
## Installation
```
go get github.com/codemicro/pkWebhookTranslator/whTranslate
```
## Usage
```go
translator := whtranslate.NewTranslator()
dgSession, _ := discordgo.New()
// receive dispatch event from PluralKit, unmarshal into a *whtranslate.DispatchEvent and validate `signing_token`
discordEmbed, err := translator.Translate(dispatchEvent)
if err != nil {
// ...
}
_, err := dgSession.WebhookExecute(whID, whToken, true, &discordgo.WebhookParams{Embeds: []*discordgo.MessageEmbed{discordEmbed}})
if err != nil {
// ...
}
```
See [main.go](examples/main.go) for an example webhook server implementation.
## License
`pkWebhookTranslate` is distributed under the MIT license. See [LICENSE](LICENSE) for more details.