private void ValidateOptions( TwitchClientOptions options ) { this.ValidateStringParameter( options.Url, "options.Url" ); if (options.Port <= 0) { throw new ArgumentException( "options.Port cannot be 0 or less", "options.Port" ); } this.ValidateStringParameter( options.AccessToken, "options.AccessToken" ); this.ValidateStringParameter( options.Nickname, "options.Nickname" ); this.ValidateStringParameter( options.MainChannel, "options.MainChannel" ); if (options.MessageSendDelay < TwitchClientOptions.VERIFIED_BOT_MESSAGE_SEND_DELAY) { throw new ArgumentException( $"options.MessageSendDelay cannot be less than TwitchClientOptions.VERIFIED_BOT_MESSAGE_SEND_DELAY ({TwitchClientOptions.VERIFIED_BOT_MESSAGE_SEND_DELAY})", "options.MessageSendDelay" ); } }
public TwitchClient( TwitchClientOptions options ) { this.ValidateOptions( options ); _options = options; // This queue is necessary to make sure we do not hit the Command & Message Limits _actionQueue = DelayedActionQueue <string> .Create( new StandardDelayedAction( (string message) => this.SendMessageToSocket( message ) ), _options.MessageSendDelay ); }