feature: Bump API version to 9 (#1847)

* First changes to the config

* Lots of changes to fit the new version

* Remove PermissionTargetConverter
This commit is contained in:
Paulo
2021-05-24 11:39:20 -03:00
committed by GitHub
parent 690bc3ff9d
commit 06a64b7877
43 changed files with 82 additions and 436 deletions

View File

@@ -16,7 +16,7 @@ namespace Discord
/// <see href="https://discord.com/developers/docs/reference#api-versioning">Discord API documentation</see>
/// .</para>
/// </returns>
public const int APIVersion = 6;
public const int APIVersion = 9;
/// <summary>
/// Returns the Voice API version Discord.Net uses.
/// </summary>
@@ -43,7 +43,7 @@ namespace Discord
/// <returns>
/// The user agent used in each Discord.Net request.
/// </returns>
public static string UserAgent { get; } = $"DiscordBot (https://github.com/RogueException/Discord.Net, v{Version})";
public static string UserAgent { get; } = $"DiscordBot (https://github.com/discord-net/Discord.Net, v{Version})";
/// <summary>
/// Returns the base Discord API URL.
/// </summary>
@@ -141,18 +141,6 @@ namespace Discord
/// </remarks>
internal bool DisplayInitialLog { get; set; } = true;
/// <summary>
/// Gets or sets the level of precision of the rate limit reset response.
/// </summary>
/// <remarks>
/// If set to <see cref="RateLimitPrecision.Second"/>, this value will be rounded up to the
/// nearest second.
/// </remarks>
/// <returns>
/// The currently set <see cref="RateLimitPrecision"/>.
/// </returns>
public RateLimitPrecision RateLimitPrecision { get; set; } = RateLimitPrecision.Millisecond;
/// <summary>
/// Gets or sets whether or not rate-limits should use the system clock.
/// </summary>

View File

@@ -28,13 +28,6 @@ namespace Discord
/// </returns>
int AFKTimeout { get; }
/// <summary>
/// Gets a value that indicates whether this guild is embeddable (i.e. can use widget).
/// </summary>
/// <returns>
/// <see langword="true" /> if this guild has a widget enabled; otherwise <see langword="false" />.
/// </returns>
bool IsEmbeddable { get; }
/// <summary>
/// Gets a value that indicates whether this guild has the widget enabled.
/// </summary>
/// <returns>
@@ -147,14 +140,6 @@ namespace Discord
/// </returns>
ulong DefaultChannelId { get; }
/// <summary>
/// Gets the ID of the widget embed channel of this guild.
/// </summary>
/// <returns>
/// A <see langword="ulong"/> representing the snowflake identifier of the embedded channel found within the
/// widget settings of this guild; <see langword="null" /> if none is set.
/// </returns>
ulong? EmbedChannelId { get; }
/// <summary>
/// Gets the ID of the channel assigned to the widget of this guild.
/// </summary>
/// <returns>
@@ -364,16 +349,6 @@ namespace Discord
/// </returns>
Task ModifyAsync(Action<GuildProperties> func, RequestOptions options = null);
/// <summary>
/// Modifies this guild's embed channel.
/// </summary>
/// <param name="func">The delegate containing the properties to modify the guild widget with.</param>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task that represents the asynchronous modification operation.
/// </returns>
[Obsolete("This endpoint is deprecated, use ModifyWidgetAsync instead.")]
Task ModifyEmbedAsync(Action<GuildEmbedProperties> func, RequestOptions options = null);
/// <summary>
/// Modifies this guild's widget.
/// </summary>
/// <param name="func">The delegate containing the properties to modify the guild widget with.</param>
@@ -592,17 +567,6 @@ namespace Discord
/// </returns>
Task<ITextChannel> GetDefaultChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
/// <summary>
/// Gets the embed channel (i.e. the channel set in the guild's widget settings) in this guild.
/// </summary>
/// <param name="mode">The <see cref="CacheMode" /> that determines whether the object should be fetched from cache.</param>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task that represents the asynchronous get operation. The task result contains the embed channel set
/// within the server's widget settings; <see langword="null" /> if none is set.
/// </returns>
[Obsolete("This endpoint is deprecated, use GetWidgetChannelAsync instead.")]
Task<IGuildChannel> GetEmbedChannelAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null);
/// <summary>
/// Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
/// </summary>
/// <param name="mode">The <see cref="CacheMode" /> that determines whether the object should be fetched from cache.</param>

View File

@@ -8,10 +8,10 @@ namespace Discord
/// <summary>
/// The target of the permission is a role.
/// </summary>
Role,
Role = 0,
/// <summary>
/// The target of the permission is a user.
/// </summary>
User
User = 1,
}
}

View File

@@ -36,18 +36,6 @@ namespace Discord
/// </returns>
Task ModifyAsync(Action<MessageProperties> func, RequestOptions options = null);
/// <summary>
/// Modifies the suppression of this message.
/// </summary>
/// <remarks>
/// This method modifies whether or not embeds in this message are suppressed (hidden).
/// </remarks>
/// <param name="suppressEmbeds">Whether or not embeds in this message should be suppressed.</param>
/// <param name="options">The options to be used when sending the request.</param>
/// <returns>
/// A task that represents the asynchronous modification operation.
/// </returns>
Task ModifySuppressionAsync(bool suppressEmbeds, RequestOptions options = null);
/// <summary>
/// Adds this message to its channel's pinned messages.
/// </summary>
/// <param name="options">The options to be used when sending the request.</param>

View File

@@ -60,9 +60,6 @@ namespace Discord
/// <summary>
/// The message is an inline reply.
/// </summary>
/// <remarks>
/// Only available in API v8.
/// </remarks>
Reply = 19,
}
}

View File

@@ -90,6 +90,9 @@ namespace Discord
/// <summary> Creates a new <see cref="GuildPermissions"/> with the provided packed value. </summary>
public GuildPermissions(ulong rawValue) { RawValue = rawValue; }
/// <summary> Creates a new <see cref="GuildPermissions"/> with the provided packed value after converting to ulong. </summary>
public GuildPermissions(string rawValue) { RawValue = ulong.Parse(rawValue); }
private GuildPermissions(ulong initialValue,
bool? createInstantInvite = null,
bool? kickMembers = null,

View File

@@ -93,6 +93,13 @@ namespace Discord
DenyValue = denyValue;
}
/// <summary> Creates a new OverwritePermissions with the provided allow and deny packed values after converting to ulong. </summary>
public OverwritePermissions(string allowValue, string denyValue)
{
AllowValue = ulong.Parse(allowValue);
DenyValue = ulong.Parse(denyValue);
}
private OverwritePermissions(ulong allowValue, ulong denyValue,
PermValue? createInstantInvite = null,
PermValue? manageChannel = null,

View File

@@ -7,10 +7,6 @@ namespace Discord
/// </summary>
public interface IPresence
{
/// <summary>
/// Gets the activity this user is currently doing.
/// </summary>
IActivity Activity { get; }
/// <summary>
/// Gets the current status of this user.
/// </summary>

View File

@@ -39,5 +39,16 @@ namespace Discord
DirectMessageReactions = 1 << 13,
/// <summary> This intent includes TYPING_START </summary>
DirectMessageTyping = 1 << 14,
/// <summary>
/// This intent includes all but <see cref="GuildMembers"/> and <see cref="GuildMembers"/>
/// that are privileged must be enabled for the application.
/// </summary>
AllUnprivileged = Guilds | GuildBans | GuildEmojis | GuildIntegrations | GuildWebhooks | GuildInvites |
GuildVoiceStates | GuildMessages | GuildMessageReactions | GuildMessageTyping | DirectMessages |
DirectMessageReactions | DirectMessageTyping,
/// <summary>
/// This intent includes all of them, including privileged ones.
/// </summary>
All = AllUnprivileged | GuildMembers | GuildPresences
}
}

View File

@@ -1,18 +0,0 @@
namespace Discord
{
/// <summary>
/// Specifies the level of precision to request in the rate limit
/// response header.
/// </summary>
public enum RateLimitPrecision
{
/// <summary>
/// Specifies precision rounded up to the nearest whole second
/// </summary>
Second,
/// <summary>
/// Specifies precision rounded to the nearest millisecond.
/// </summary>
Millisecond
}
}