Browse Source

Working-ish state

pull/2510/head
Misha133 2 years ago
parent
commit
4b15069cca
7 changed files with 9 additions and 53 deletions
  1. +3
    -0
      src/Discord.Net.Core/Entities/Invites/IInvite.cs
  2. +1
    -1
      src/Discord.Net.Rest/API/Common/Guild.cs
  3. +1
    -1
      src/Discord.Net.Rest/API/Common/Invite.cs
  4. +0
    -47
      src/Discord.Net.Rest/API/Common/InviteGuild.cs
  5. +1
    -1
      src/Discord.Net.Rest/ClientHelper.cs
  6. +2
    -2
      src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
  7. +1
    -1
      src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs

+ 3
- 0
src/Discord.Net.Core/Entities/Invites/IInvite.cs View File

@@ -56,6 +56,9 @@ namespace Discord
/// <summary>
/// Gets the guild this invite is linked to.
/// </summary>
/// <remarks>
/// Guild might have empty properties due to API not returning full guild object.
/// </remarks>
/// <returns>
/// A guild object representing the guild that the invite points to.
/// </returns>


+ 1
- 1
src/Discord.Net.Rest/API/Common/Guild.cs View File

@@ -66,7 +66,7 @@ namespace Discord.API
[JsonProperty("premium_subscription_count")]
public int? PremiumSubscriptionCount { get; set; }
[JsonProperty("preferred_locale")]
public string PreferredLocale { get; set; }
public Optional<string> PreferredLocale { get; set; }
[JsonProperty("public_updates_channel_id")]
public ulong? PublicUpdatesChannelId { get; set; }
[JsonProperty("max_video_channel_users")]


+ 1
- 1
src/Discord.Net.Rest/API/Common/Invite.cs View File

@@ -7,7 +7,7 @@ namespace Discord.API
[JsonProperty("code")]
public string Code { get; set; }
[JsonProperty("guild")]
public Optional<InviteGuild> Guild { get; set; }
public Optional<Guild> Guild { get; set; }
[JsonProperty("channel")]
public InviteChannel Channel { get; set; }
[JsonProperty("inviter")]


+ 0
- 47
src/Discord.Net.Rest/API/Common/InviteGuild.cs View File

@@ -1,47 +0,0 @@
using Newtonsoft.Json;
using System.Collections.Generic;

namespace Discord.API
{
internal class InviteGuild
{
[JsonProperty("id")]
public ulong Id { get; set; }

[JsonProperty("name")]
public string Name { get; set; }

[JsonProperty("splash")]
public Optional<string> Splash { get; set; }

[JsonProperty("banner")]
public Optional<string> BannerHash { get; set; }

[JsonProperty("description")]
public Optional<string> Description { get; set; }

[JsonProperty("icon")]
public Optional<string> IconHash { get; set; }

[JsonProperty("features")]
public GuildFeatures Features { get; set; }

[JsonProperty("verification_level")]
public VerificationLevel VerificationLevel { get; set; }

[JsonProperty("vanity_url_code")]
public Optional<string> VanityUrlCode { get; set; }

[JsonProperty("premium_subscription_count")]
public Optional<int> PremiumSubscriptionCount { get; set; }

[JsonProperty("nsfw")]
public Optional<bool?> Nsfw { get; set; }

[JsonProperty("nsfw_level")]
public NsfwLevel NsfwLevel { get; set; }

[JsonProperty("welcome_screen")]
public Optional<WelcomeScreen> WelcomeScreen { get; set; }
}
}

+ 1
- 1
src/Discord.Net.Rest/ClientHelper.cs View File

@@ -57,7 +57,7 @@ namespace Discord.Rest
{
var model = await client.ApiClient.GetInviteAsync(inviteId, options).ConfigureAwait(false);
if (model != null)
return RestInviteMetadata.Create(client, null, null, model);
return RestInviteMetadata.Create(client, RestGuild.Create(client, model.Guild.IsSpecified ? model.Guild.Value : null), null, model);
return null;
}



+ 2
- 2
src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs View File

@@ -181,8 +181,8 @@ namespace Discord.Rest
MaxMembers = model.MaxMembers.Value;
if (model.MaxVideoChannelUsers.IsSpecified)
MaxVideoChannelUsers = model.MaxVideoChannelUsers.Value;
PreferredLocale = model.PreferredLocale;
PreferredCulture = new CultureInfo(PreferredLocale);
PreferredLocale = model.PreferredLocale.IsSpecified ? model.PreferredLocale.Value : null;
PreferredCulture = model.PreferredLocale.IsSpecified ? new CultureInfo(PreferredLocale) : null;
if (model.ApproximateMemberCount.IsSpecified)
ApproximateMemberCount = model.ApproximateMemberCount.Value;
if (model.ApproximatePresenceCount.IsSpecified)


+ 1
- 1
src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs View File

@@ -515,7 +515,7 @@ namespace Discord.WebSocket
MaxMembers = model.MaxMembers.Value;
if (model.MaxVideoChannelUsers.IsSpecified)
MaxVideoChannelUsers = model.MaxVideoChannelUsers.Value;
PreferredLocale = model.PreferredLocale;
PreferredLocale = model.PreferredLocale.IsSpecified ? model.PreferredLocale.Value : null;
PreferredCulture = PreferredLocale == null ? null : new CultureInfo(PreferredLocale);
if (model.IsBoostProgressBarEnabled.IsSpecified)
IsBoostProgressBarEnabled = model.IsBoostProgressBarEnabled.Value;


Loading…
Cancel
Save