init
This commit is contained in:
26
local/utl/discord/discord.go
Normal file
26
local/utl/discord/discord.go
Normal file
@@ -0,0 +1,26 @@
|
||||
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!")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user