quin lynch 3 years ago
parent
commit
36bc9df634
6 changed files with 13 additions and 4 deletions
  1. +1
    -1
      src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs
  2. +4
    -0
      src/Discord.Net.Core/Entities/Teams/ITeam.cs
  3. +1
    -1
      src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs
  4. +2
    -0
      src/Discord.Net.Rest/API/Common/Team.cs
  5. +3
    -0
      src/Discord.Net.Rest/Entities/Teams/RestTeam.cs
  6. +2
    -2
      test/Discord.Net.Tests.Unit/EmbedBuilderTests.cs

+ 1
- 1
src/Discord.Net.Core/Entities/Messages/EmbedBuilder.cs View File

@@ -27,7 +27,7 @@ namespace Discord
/// <summary>
/// Returns the maximum length of description allowed by Discord.
/// </summary>
public const int MaxDescriptionLength = 2048;
public const int MaxDescriptionLength = 4096;
/// <summary>
/// Returns the maximum length of total characters allowed by Discord.
/// </summary>


+ 4
- 0
src/Discord.Net.Core/Entities/Teams/ITeam.cs View File

@@ -20,6 +20,10 @@ namespace Discord
/// </summary>
IReadOnlyList<ITeamMember> TeamMembers { get; }
/// <summary>
/// Gets the name of this team.
/// </summary>
string Name { get; }
/// <summary>
/// Gets the user identifier that owns this team.
/// </summary>
ulong OwnerUserId { get; }


+ 1
- 1
src/Discord.Net.Core/Extensions/EmbedBuilderExtensions.cs View File

@@ -27,7 +27,7 @@ namespace Discord

/// <summary> Fills the embed author field with the provided user's full username and avatar URL. </summary>
public static EmbedBuilder WithAuthor(this EmbedBuilder builder, IUser user) =>
builder.WithAuthor($"{user.Username}#{user.Discriminator}", user.GetAvatarUrl());
builder.WithAuthor($"{user.Username}#{user.Discriminator}", user.GetAvatarUrl() ?? user.GetDefaultAvatarUrl());

/// <summary> Converts a <see cref="EmbedType.Rich"/> <see cref="IEmbed"/> object to a <see cref="EmbedBuilder"/>. </summary>
/// <exception cref="InvalidOperationException">The embed type is not <see cref="EmbedType.Rich"/>.</exception>


+ 2
- 0
src/Discord.Net.Rest/API/Common/Team.cs View File

@@ -11,6 +11,8 @@ namespace Discord.API
public ulong Id { get; set; }
[JsonProperty("members")]
public TeamMember[] TeamMembers { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("owner_user_id")]
public ulong OwnerUserId { get; set; }
}


+ 3
- 0
src/Discord.Net.Rest/Entities/Teams/RestTeam.cs View File

@@ -12,6 +12,8 @@ namespace Discord.Rest
/// <inheritdoc />
public IReadOnlyList<ITeamMember> TeamMembers { get; private set; }
/// <inheritdoc />
public string Name { get; private set; }
/// <inheritdoc />
public ulong OwnerUserId { get; private set; }

private string _iconId;
@@ -30,6 +32,7 @@ namespace Discord.Rest
{
if (model.Icon.IsSpecified)
_iconId = model.Icon.Value;
Name = model.Name;
OwnerUserId = model.OwnerUserId;
TeamMembers = model.TeamMembers.Select(x => new RestTeamMember(Discord, x)).ToImmutableArray();
}


+ 2
- 2
test/Discord.Net.Tests.Unit/EmbedBuilderTests.cs View File

@@ -126,7 +126,7 @@ namespace Discord
{
IEnumerable<string> GetInvalid()
{
yield return new string('a', 2049);
yield return new string('a', 4097);
}
foreach (var description in GetInvalid())
{
@@ -149,7 +149,7 @@ namespace Discord
{
yield return string.Empty;
yield return null;
yield return new string('a', 2048);
yield return new string('a', 4096);
}
foreach (var description in GetValid())
{


Loading…
Cancel
Save