| @@ -18,5 +18,13 @@ namespace Discord | |||||
| /// Returns the current user's permissions for this guild. | /// Returns the current user's permissions for this guild. | ||||
| /// </summary> | /// </summary> | ||||
| GuildPermissions Permissions { get; } | GuildPermissions Permissions { get; } | ||||
| /// <summary> | |||||
| /// Gets the features for this guild. | |||||
| /// </summary> | |||||
| /// <returns> | |||||
| /// A flags enum containing all the features for the guild. | |||||
| /// </returns> | |||||
| GuildFeatures Features { get; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -14,5 +14,7 @@ namespace Discord.API | |||||
| public bool Owner { get; set; } | public bool Owner { get; set; } | ||||
| [JsonProperty("permissions"), Int53] | [JsonProperty("permissions"), Int53] | ||||
| public string Permissions { get; set; } | public string Permissions { get; set; } | ||||
| [JsonProperty("features")] | |||||
| public GuildFeatures Features { get; set; } | |||||
| } | } | ||||
| } | } | ||||
| @@ -152,6 +152,19 @@ namespace Discord.Rest | |||||
| #endregion | #endregion | ||||
| public async Task<RestSelfUser> GetCurrentUserAsync(RequestOptions options = null) | |||||
| { | |||||
| var user = RestSelfUser.Create(this, await ApiClient.GetMyUserAsync(options)); | |||||
| base.CurrentUser = user; | |||||
| return user; | |||||
| } | |||||
| public async Task<RestGuildUser> GetCurrentUserGuildMemberAsync(ulong guildId, RequestOptions options = null) | |||||
| { | |||||
| var user = await ApiClient.GetCurrentUserGuildMember(guildId, options); | |||||
| return RestGuildUser.Create(this, null, user, guildId); | |||||
| } | |||||
| public async Task<RestApplication> GetApplicationInfoAsync(RequestOptions options = null) | public async Task<RestApplication> GetApplicationInfoAsync(RequestOptions options = null) | ||||
| { | { | ||||
| return _applicationInfo ??= await ClientHelper.GetApplicationInfoAsync(this, options).ConfigureAwait(false); | return _applicationInfo ??= await ClientHelper.GetApplicationInfoAsync(this, options).ConfigureAwait(false); | ||||
| @@ -21,6 +21,8 @@ namespace Discord.Rest | |||||
| public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); | ||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public string IconUrl => CDN.GetGuildIconUrl(Id, _iconId); | public string IconUrl => CDN.GetGuildIconUrl(Id, _iconId); | ||||
| /// <inheritdoc /> | |||||
| public GuildFeatures Features { get; private set; } | |||||
| internal RestUserGuild(BaseDiscordClient discord, ulong id) | internal RestUserGuild(BaseDiscordClient discord, ulong id) | ||||
| : base(discord, id) | : base(discord, id) | ||||
| @@ -39,12 +41,20 @@ namespace Discord.Rest | |||||
| IsOwner = model.Owner; | IsOwner = model.Owner; | ||||
| Name = model.Name; | Name = model.Name; | ||||
| Permissions = new GuildPermissions(model.Permissions); | Permissions = new GuildPermissions(model.Permissions); | ||||
| Features = model.Features; | |||||
| } | } | ||||
| public async Task LeaveAsync(RequestOptions options = null) | public async Task LeaveAsync(RequestOptions options = null) | ||||
| { | { | ||||
| await Discord.ApiClient.LeaveGuildAsync(Id, options).ConfigureAwait(false); | await Discord.ApiClient.LeaveGuildAsync(Id, options).ConfigureAwait(false); | ||||
| } | } | ||||
| public async Task<RestGuildUser> GetCurrentUserGuildMemberAsync(RequestOptions options = null) | |||||
| { | |||||
| var user = await Discord.ApiClient.GetCurrentUserGuildMember(Id, options); | |||||
| return RestGuildUser.Create(Discord, null, user, Id); | |||||
| } | |||||
| /// <inheritdoc /> | /// <inheritdoc /> | ||||
| public async Task DeleteAsync(RequestOptions options = null) | public async Task DeleteAsync(RequestOptions options = null) | ||||
| { | { | ||||