|
|
@@ -46,6 +46,8 @@ namespace Discord.Rest |
|
|
|
/// <inheritdoc /> |
|
|
|
public DateTime CreatedAt => DateTimeHelper.FromSnowflake(Id); |
|
|
|
/// <inheritdoc /> |
|
|
|
public bool IsOwner => OwnerId == Discord.CurrentUser.Id; |
|
|
|
/// <inheritdoc /> |
|
|
|
public string IconUrl => API.CDN.GetGuildIconUrl(Id, _iconId); |
|
|
|
/// <inheritdoc /> |
|
|
|
public string SplashUrl => API.CDN.GetGuildSplashUrl(Id, _splashId); |
|
|
@@ -155,11 +157,15 @@ namespace Discord.Rest |
|
|
|
/// <inheritdoc /> |
|
|
|
public async Task Leave() |
|
|
|
{ |
|
|
|
if (IsOwner) |
|
|
|
throw new InvalidOperationException("Unable to leave a guild the current user owns."); |
|
|
|
await Discord.BaseClient.LeaveGuild(Id).ConfigureAwait(false); |
|
|
|
} |
|
|
|
/// <inheritdoc /> |
|
|
|
public async Task Delete() |
|
|
|
{ |
|
|
|
if (!IsOwner) |
|
|
|
throw new InvalidOperationException("Unable to delete a guild the current user does not own."); |
|
|
|
await Discord.BaseClient.DeleteGuild(Id).ConfigureAwait(false); |
|
|
|
} |
|
|
|
|
|
|
|