44 lines
887 B
Go
44 lines
887 B
Go
package main
|
|
|
|
import (
|
|
reddit "github.com/cameronstanley/go-reddit"
|
|
viper "github.com/spf13/viper"
|
|
)
|
|
|
|
var (
|
|
appID = "gdq-vod-bot"
|
|
appName = "Icedream's GamesDoneQuick VoD Bot"
|
|
appVersion = "dev"
|
|
)
|
|
|
|
type redditConfig struct {
|
|
ClientID string
|
|
ClientSecret string
|
|
RedirectURI string
|
|
AppID string
|
|
VersionString string
|
|
RedditUsername string
|
|
}
|
|
|
|
type config struct {
|
|
Reddit redditConfig
|
|
}
|
|
|
|
func main() {
|
|
viper.SetDefault("Reddit.ClientID", "")
|
|
viper.SetDefault("Reddit.ClientSecret", "")
|
|
viper.SetDefault("Reddit.RedirectURI", "https://gdq-vod-bot.icedream.tech/redditRedirect")
|
|
|
|
c := new(config)
|
|
viper.Unmarshal(c)
|
|
|
|
authenticator := reddit.NewAuthenticator(
|
|
c.Reddit.ClientID,
|
|
c.Reddit.ClientSecret,
|
|
c.Reddit.RedirectURI,
|
|
"<platform>:<app Id>:<version string> (by /u/<reddit username>)",
|
|
"<random string>",
|
|
reddit.ScopeIdentity,
|
|
)
|
|
}
|