package discordbot import "github.com/bwmarrin/discordgo" // GetSession - Get a discord session from the provided token func GetSession(token string) (*discordgo.Session, error) { session, err := discordgo.New("Bot " + token) // If we can not create the client then just fatal. if err != nil { return nil, err } session.Identify.Intents = discordgo.IntentsGuildMembers | discordgo.IntentsGuildVoiceStates | discordgo.IntentsGuildMessages | discordgo.IntentsDirectMessages | discordgo.IntentsDirectMessageReactions // Open a websocket connection to Discord and begin listening. err = session.Open() if err != nil { return nil, err } return session, nil }