27 lines
398 B
Go
27 lines
398 B
Go
package discordrhu
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
"go.uber.org/dig"
|
|
)
|
|
|
|
func Init(di *dig.Container) {
|
|
dsc, err := discordgo.New("Bot " + os.Getenv("DISCORD_KEY"))
|
|
|
|
if err != nil {
|
|
log.Panic("unable to start discord session!")
|
|
}
|
|
|
|
err = di.Provide(func() *discordgo.Session {
|
|
return dsc
|
|
})
|
|
|
|
if err != nil {
|
|
log.Panic("unable to provide discord session!")
|
|
}
|
|
|
|
}
|