func NewClient(conf *Config) (DiscordWebsocket, error) {
	if conf == nil {
		return nil, errors.New("Config struct")
	}

	err := conf.Validate()
	if err != nil {
		return nil, err
	}

	// check the http client exists. Otherwise create one.
	if conf.HTTPClient == nil {
		conf.HTTPClient = &http.Client{
			Timeout: time.Second * DefaultHTTPTimeout,
		}
	}

	// configure logrus output
	logrus.SetFormatter(&logrus.TextFormatter{
		FullTimestamp:   true,
		TimestampFormat: "2006-01-02 15:04:05",
	})

	if conf.Debug {
		logrus.SetLevel(logrus.DebugLevel)
	}

	// return configured discord websocket client
	return &Client{
		conf:               conf,
		urlAPIVersion:      BaseURL + "/v" + strconv.Itoa(conf.DAPIVersion),
		lastHeartbeatAck:   time.Now(),
		disconnected:       nil,
		discordWSEventChan: make(chan DiscordWSEvent, conf.ChannelBuffer),
		operationChan:      make(chan *gatewayEvent),
		eventChans:         make(map[string]chan []byte),
		sendChan:           make(chan *gatewayPayload),
		//Myself:            &user.User{},
	}, nil
}
// NewClient Creates a new discord websocket client
NewClient Creates a new discord websocket client
// NewClient Creates a new discord websocket client
func NewClient(conf *Config) (DiscordWebsocket, error) {
	if conf == nil {
		return nil, errors.New("Config struct")
	}
	err := conf.Validate()
	if err != nil {
		return nil, err
	}
	if conf.HTTPClient == nil {
		conf.HTTPClient = &http.Client{
			Timeout: time.Second * DefaultHTTPTimeout,
		}
	}
	logrus.SetFormatter(&logrus.TextFormatter{
		FullTimestamp:   true,
		TimestampFormat: "2006-01-02 15:04:05",
	})
	if conf.Debug {
		logrus.SetLevel(logrus.DebugLevel)
	}
	return &Client{
		conf:               conf,
		urlAPIVersion:      BaseURL + "/v" + strconv.Itoa(conf.DAPIVersion),
		lastHeartbeatAck:   time.Now(),
		disconnected:       nil,
		discordWSEventChan: make(chan DiscordWSEvent, conf.ChannelBuffer),
		operationChan:      make(chan *gatewayEvent),
		eventChans:         make(map[string]chan []byte),
		sendChan:           make(chan *gatewayPayload),
	}, nil
}
func NewClient ( conf * Config ) ( DiscordWebsocket , error ) { if conf == nil { return nil , errors . New ( " " ) } err := conf . Validate ( ) if err != nil { return nil , err } if conf . HTTPClient == nil { conf . HTTPClient = & http . Client { Timeout : time . Second * DefaultHTTPTimeout , } } logrus . SetFormatter ( & logrus . TextFormatter { FullTimestamp : true , TimestampFormat : " " , } ) if conf . Debug { logrus . SetLevel ( logrus . DebugLevel ) } return & Client { conf : conf , urlAPIVersion : BaseURL + " " + strconv . Itoa ( conf . DAPIVersion ) , lastHeartbeatAck : time . Now ( ) , disconnected : nil , discordWSEventChan : make ( chan DiscordWSEvent , conf . ChannelBuffer ) , operationChan : make ( chan * gatewayEvent ) , eventChans : make ( map [ string ] chan [ ] byte ) , sendChan : make ( chan * gatewayPayload ) , } , nil }
NewClient Creates a new discord websocket client
NewClient Creates a new discord websocket client
// check the http client exists. Otherwise create one. // configure logrus output // return configured discord websocket client //Myself:            &user.User{},