galched-bot/modules/settings/settings.go

59 lines
1.5 KiB
Go
Raw Permalink Normal View History

package settings
2019-05-10 08:53:58 +00:00
import (
"io/ioutil"
"log"
)
const (
2019-07-28 20:10:24 +00:00
version = "4.1.0"
twitchUser = "galchedbot"
twitchIRCRoom = "galched"
discordTokenPath = "./tokens/.discordtoken"
twitchTokenPath = "./tokens/.twitchtoken"
subdayDataPath = "./backups/subday"
// Permitted roles in discord for subday
subRole1 = "433672344737677322"
subRole2 = "433680494635515904"
galchedRole = "301467455497175041"
smorcRole = "301470784491356172"
)
type (
Settings struct {
2019-07-28 20:10:24 +00:00
Version string
DiscordToken string
TwitchUser string
TwitchIRCRoom string
TwitchToken string
SubdayDataPath string
PermittedRoles []string
PolkaPath string
DiscordVoiceChannel string
}
)
2019-05-10 08:53:58 +00:00
func New() (*Settings, error) {
discordToken, err := ioutil.ReadFile(discordTokenPath)
if err != nil {
log.Print("settings: cannot read discord token file", err)
}
twitchToken, err := ioutil.ReadFile(twitchTokenPath)
if err != nil {
log.Print("settings: cannot read twitch token file", err)
}
2019-05-10 08:53:58 +00:00
return &Settings{
2019-07-28 20:10:24 +00:00
Version: version,
DiscordToken: string(discordToken),
TwitchToken: string(twitchToken),
TwitchUser: twitchUser,
TwitchIRCRoom: twitchIRCRoom,
SubdayDataPath: subdayDataPath,
PolkaPath: "songs/polka.dca",
DiscordVoiceChannel: "301793085522706432",
PermittedRoles: []string{subRole1, subRole2, galchedRole, smorcRole},
2019-05-10 08:53:58 +00:00
}, nil
}