var result = await client.PostAsync($"{ApiUrl}/overrides/{id}/dependency", new StringContent($"{{ \"info\": \"{name}\"}}", Encoding.UTF8, "application/json"));
var result = await client.PostAsync($"{ApiUrl}/overrides/{id}/dependency", new StringContent($"{{ \"info\": \"{name}\"}}", Encoding.UTF8, "application/json"));
if (!result.IsSuccessStatusCode)
if (!result.IsSuccessStatusCode)
throw new Exception("Failed to get dependency");
throw new Exception("Failed to get dependency");
using(var ms = new MemoryStream())
using(var ms = new MemoryStream())
{
{
var innerStream = await result.Content.ReadAsStreamAsync();
var innerStream = await result.Content.ReadAsStreamAsync();
@@ -38,7 +38,7 @@ public class RoleConnectionProperties
get => _platformUsername;
get => _platformUsername;
set
set
{
{
if(value is not null)
if(value is not null)
Preconditions.AtMost(value.Length, MaxPlatformUsernameLength, nameof(PlatformUsername), $"Platform username length must be less or equal to {MaxPlatformUsernameLength}");
Preconditions.AtMost(value.Length, MaxPlatformUsernameLength, nameof(PlatformUsername), $"Platform username length must be less or equal to {MaxPlatformUsernameLength}");
_platformUsername = value;
_platformUsername = value;
}
}
@@ -103,7 +103,7 @@ public class RoleConnectionProperties
Preconditions.AtMost(Metadata.Count + 1, MaxPlatformUsernameLength, nameof(Metadata), $"Metadata records count must be less or equal to {MaxMetadataRecords}");
Preconditions.AtMost(Metadata.Count + 1, MaxPlatformUsernameLength, nameof(Metadata), $"Metadata records count must be less or equal to {MaxMetadataRecords}");
_metadata[key] = value;
_metadata[key] = value;
@@ -126,7 +126,7 @@ public class RoleConnectionProperties
/// <summary>
/// <summary>
/// Initializes a new instance of <see cref="RoleConnectionProperties"/>.
/// Initializes a new instance of <see cref="RoleConnectionProperties"/>.
/// </summary>
/// </summary>
public RoleConnectionProperties() {}
public RoleConnectionProperties() {}
/// <summary>
/// <summary>
/// Initializes a new <see cref="RoleConnectionProperties"/> with the data from provided <see cref="RoleConnection"/>.
/// Initializes a new <see cref="RoleConnectionProperties"/> with the data from provided <see cref="RoleConnection"/>.
if (value?.Length > MaxTitleLength) throw new ArgumentException(message: $"Title length must be less than or equal to {MaxTitleLength}.", paramName: nameof(Title));
if (value?.Length > MaxTitleLength)
throw new ArgumentException(message: $"Title length must be less than or equal to {MaxTitleLength}.", paramName: nameof(Title));
_title = value;
_title = value;
}
}
}
}
@@ -63,7 +64,8 @@ namespace Discord
get => _description;
get => _description;
set
set
{
{
if (value?.Length > MaxDescriptionLength) throw new ArgumentException(message: $"Description length must be less than or equal to {MaxDescriptionLength}.", paramName: nameof(Description));
if (value?.Length > MaxDescriptionLength)
throw new ArgumentException(message: $"Description length must be less than or equal to {MaxDescriptionLength}.", paramName: nameof(Description));
_description = value;
_description = value;
}
}
}
}
@@ -100,8 +102,10 @@ namespace Discord
get => _fields;
get => _fields;
set
set
{
{
if (value == null) throw new ArgumentNullException(paramName: nameof(Fields), message: "Cannot set an embed builder's fields collection to null.");
if (value.Count > MaxFieldCount) throw new ArgumentException(message: $"Field count must be less than or equal to {MaxFieldCount}.", paramName: nameof(Fields));
if (value == null)
throw new ArgumentNullException(paramName: nameof(Fields), message: "Cannot set an embed builder's fields collection to null.");
if (value.Count > MaxFieldCount)
throw new ArgumentException(message: $"Field count must be less than or equal to {MaxFieldCount}.", paramName: nameof(Fields));
_fields = value;
_fields = value;
}
}
}
}
@@ -470,7 +474,7 @@ namespace Discord
if (!string.IsNullOrEmpty(Author.IconUrl))
if (!string.IsNullOrEmpty(Author.IconUrl))
UrlValidation.Validate(Author.IconUrl, true);
UrlValidation.Validate(Author.IconUrl, true);
}
}
if(Footer != null)
if(Footer != null)
{
{
if (!string.IsNullOrEmpty(Footer.IconUrl))
if (!string.IsNullOrEmpty(Footer.IconUrl))
UrlValidation.Validate(Footer.IconUrl, true);
UrlValidation.Validate(Footer.IconUrl, true);
@@ -564,8 +568,10 @@ namespace Discord
get => _name;
get => _name;
set
set
{
{
if (string.IsNullOrWhiteSpace(value)) throw new ArgumentException(message: "Field name must not be null, empty or entirely whitespace.", paramName: nameof(Name));
if (value.Length > MaxFieldNameLength) throw new ArgumentException(message: $"Field name length must be less than or equal to {MaxFieldNameLength}.", paramName: nameof(Name));
if (string.IsNullOrWhiteSpace(value))
throw new ArgumentException(message: "Field name must not be null, empty or entirely whitespace.", paramName: nameof(Name));
if (value.Length > MaxFieldNameLength)
throw new ArgumentException(message: $"Field name length must be less than or equal to {MaxFieldNameLength}.", paramName: nameof(Name));
_name = value;
_name = value;
}
}
}
}
@@ -587,8 +593,10 @@ namespace Discord
set
set
{
{
var stringValue = value?.ToString();
var stringValue = value?.ToString();
if (string.IsNullOrWhiteSpace(stringValue)) throw new ArgumentException(message: "Field value must not be null or empty.", paramName: nameof(Value));
if (stringValue.Length > MaxFieldValueLength) throw new ArgumentException(message: $"Field value length must be less than or equal to {MaxFieldValueLength}.", paramName: nameof(Value));
if (string.IsNullOrWhiteSpace(stringValue))
throw new ArgumentException(message: "Field value must not be null or empty.", paramName: nameof(Value));
if (stringValue.Length > MaxFieldValueLength)
throw new ArgumentException(message: $"Field value length must be less than or equal to {MaxFieldValueLength}.", paramName: nameof(Value));
_value = stringValue;
_value = stringValue;
}
}
}
}
@@ -704,7 +712,8 @@ namespace Discord
get => _name;
get => _name;
set
set
{
{
if (value?.Length > MaxAuthorNameLength) throw new ArgumentException(message: $"Author name length must be less than or equal to {MaxAuthorNameLength}.", paramName: nameof(Name));
if (value?.Length > MaxAuthorNameLength)
throw new ArgumentException(message: $"Author name length must be less than or equal to {MaxAuthorNameLength}.", paramName: nameof(Name));
_name = value;
_name = value;
}
}
}
}
@@ -836,7 +845,8 @@ namespace Discord
get => _text;
get => _text;
set
set
{
{
if (value?.Length > MaxFooterTextLength) throw new ArgumentException(message: $"Footer text length must be less than or equal to {MaxFooterTextLength}.", paramName: nameof(Text));
if (value?.Length > MaxFooterTextLength)
throw new ArgumentException(message: $"Footer text length must be less than or equal to {MaxFooterTextLength}.", paramName: nameof(Text));
/// <param name="customId">String to compare the Message Component CustomIDs with.</param>
/// <param name="customId">String to compare the Message Component CustomIDs with.</param>
/// <param name="ignoreGroupNames">If <see langword="true"/> <see cref="GroupAttribute"/>s will be ignored while creating this command and this method will be treated as a top level command.</param>
/// <param name="ignoreGroupNames">If <see langword="true"/> <see cref="GroupAttribute"/>s will be ignored while creating this command and this method will be treated as a top level command.</param>
/// <param name="runMode">Set the run mode of the command.</param>
/// <param name="runMode">Set the run mode of the command.</param>
/// Gets the string to compare the Modal CustomIDs with.
/// Gets the string to compare the Modal CustomIDs with.
/// </summary>
/// </summary>
public string CustomId { get; }
public string CustomId { get; }
/// <summary>
/// <summary>
/// Gets <see langword="true"/> if <see cref="GroupAttribute"/>s will be ignored while creating this command and this method will be treated as a top level command.
/// Gets <see langword="true"/> if <see cref="GroupAttribute"/>s will be ignored while creating this command and this method will be treated as a top level command.
/// <param name="description">Description of the command.</param>
/// <param name="description">Description of the command.</param>
/// <param name="ignoreGroupNames"> If <see langword="true"/>, <see cref="GroupAttribute"/>s will be ignored while creating this command and this method will be treated as a top level command.</param>
/// <param name="ignoreGroupNames"> If <see langword="true"/>, <see cref="GroupAttribute"/>s will be ignored while creating this command and this method will be treated as a top level command.</param>
/// <param name="runMode">Set the run mode of the command.</param>
/// <param name="runMode">Set the run mode of the command.</param>
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.