/// <summary> /// Connects to Guilded bot using parameter as an auth. /// </summary> /// <remarks> /// <para>Creates a new connection to Guilded using argument <paramref name="auth" />. This does not use <see cref="AuthToken" />.</para> /// <para>To disconnect from Guilded, use <see cref="BaseGuildedClient.DisconnectAsync" /></para> /// </remarks> /// <param name="auth">The token to be used for authorization</param> /// <exception cref="ArgumentNullException">When passed argument <paramref name="auth" /> is <see langword="null" />, empty or whitespace</exception> /// <seealso cref="ConnectAsync()" /> /// <seealso cref="GuildedBotClient()" /> public async Task ConnectAsync(string auth) { if (string.IsNullOrWhiteSpace(auth)) { throw new ArgumentNullException(nameof(auth)); } // Give authentication token to Guilded AdditionalHeaders.Add("Authorization", $"Bearer {auth}"); // Add all headers to the clients Rest.AddDefaultHeaders(AdditionalHeaders); await base.ConnectAsync().ConfigureAwait(false); }