galched-bot/modules/settings/settings.go

35 lines
531 B
Go
Raw Normal View History

package settings
2019-05-10 08:53:58 +00:00
import (
"io/ioutil"
"log"
"os"
"github.com/pkg/errors"
)
const (
version = "3.0.0"
discordTokenPath = "./tokens/.discordtoken"
)
type (
Settings struct {
2019-05-10 08:53:58 +00:00
Version string
DiscordToken string
}
)
2019-05-10 08:53:58 +00:00
func New() (*Settings, error) {
log.Print(os.Getwd())
discordToken, err := ioutil.ReadFile(discordTokenPath)
if err != nil {
return nil, errors.Wrap(err, "cannot read discord token file")
}
2019-05-10 08:53:58 +00:00
return &Settings{
Version: version,
DiscordToken: string(discordToken),
}, nil
}