package main import ( discordspeaker "dndmusicbot/speaker" "log" "github.com/bwmarrin/discordgo" ) func init() { log.Println("discord.go loading..") var err error token := config.GetString("discord.token") guild := config.GetString("discord.guild") channel := config.GetString("discord.channel") app.discord, err = discordgo.New("Bot " + token) if err != nil { return } // app.discord.LogLevel = discordgo.LogDebug err = app.discord.Open() if err != nil { return } app.voice, err = app.discord.ChannelVoiceJoin(guild, channel, false, true) if err != nil { return } // app.voice.LogLevel = discordgo.LogDebug err = discordspeaker.Init(app.voice) if err != nil { log.Fatal(err) } log.Println("discord.go done.") }