notify

package
v0.0.0-...-fa8de75 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MessageSizeLimit will be the maximum size of a message
	// that we can send with our notification system.
	// The limit is caused by Twitter's maximum tweet size.
	//
	// We believe Twitter has the SMALLEST constraint of all of our
	// integrations, and therefore sets the bar.
	MessageSizeLimit int = 280

	EnableDiscordSend  bool = false
	EnableTwitterSend  bool = false
	EnableMastodonSend bool = true
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier

type Notifier struct {
	Message string
	Discord *discordgo.Session

	Twitter  *anaconda.TwitterApi
	Mastodon *madon.Client
	// contains filtered or unexported fields
}

func New

func New(message string) *Notifier

func (*Notifier) EnableDiscord

func (n *Notifier) EnableDiscord(token string, channel string) error

EnableDiscord will use the Bot API to communicate with Discord. You must pass the RAW token data to this function in order to create a new client.

More: https://discord.com/developers/

The bot must be linked to a specific server which can be done via:

https://discord.com/oauth2/authorize?client_id=YOUR_ID_HERE&scope=bot&permissions=2048

func (*Notifier) EnableMastodon

func (n *Notifier) EnableMastodon(server, accessToken, clientID, clientSecret, user, pass string) error

func (*Notifier) EnableTwitter

func (n *Notifier) EnableTwitter(accessToken, accessTokenSecret, consumerKey, consumerKeySecret string) error

func (*Notifier) Notify

func (n *Notifier) Notify() error

Jump to

Keyboard shortcuts

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