HwidBot/main.go

35 lines
628 B
Go
Raw Normal View History

2024-07-06 16:18:05 +02:00
package main
import (
"fmt"
2024-07-06 16:29:25 +02:00
"github.com/BurntSushi/toml"
"github.com/bwmarrin/discordgo"
2024-07-06 16:18:05 +02:00
)
2024-07-06 16:29:25 +02:00
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
}
2024-07-06 16:18:05 +02:00
func main(){
2024-07-06 16:29:25 +02:00
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()
2024-07-06 16:18:05 +02:00
}