Documentation
¶
Overview ¶
Package reddit implements a Reddit notifier, allowing messages to be sent to multiple recipients
Usage:
package main
import (
"context"
"github.com/nikoksr/notify"
"github.com/nikoksr/notify/service/reddit"
)
func main() {
notifier := notify.New()
// Provide your Reddit app credentials and username/password
redditService := reddit.New("clientID", "clientSecret", "username", "password")
// Pass the usernames for where to send the messages
pushoverService.AddReceivers("User1", "User2")
// Tell our notifier to use the Reddit service. You can repeat the above process
// for as many services as you like and just tell the notifier to use them.
notifier.UseServices(redditService)
// Send a message
_ = notifier.Send(
context.Background(),
"Hello!",
"I am a bot written in Go!",
)
}
Package reddit implements a Reddit notifier, allowing messages to be sent to multiple recipients
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reddit ¶
type Reddit struct {
// contains filtered or unexported fields
}
Reddit struct holds necessary data to communicate with the Reddit API.
func New ¶
New returns a new instance of a Reddit notification service. For more information on obtaining client credentials:
-> https://github.com/reddit-archive/reddit/wiki/OAuth2
func (*Reddit) AddReceivers ¶
AddReceivers takes Reddit usernames and adds them to the internal recipient list. The Send method will send a given message to all of those users.
Click to show internal directories.
Click to hide internal directories.