package main import ( "fmt" "github.com/BurntSushi/toml" "github.com/bwmarrin/discordgo" ) type Config struct { Token string `toml:"token"` GuildID string `toml:"guildId"` } func loadConfig(filename string) (Config, error) { var config Config _, err := toml.DecodeFile(filename, &config) return config, err } func main(){ config, err := loadConfig("config.toml") if err != nil { fmt.Println("Error occured whilst trying to load config: ", err) return } client, err := discordgo.New("Bot " + config.Token) if err != nil { fmt.Println("Error initalizing bot: ", err) return } defer client.Close() }