docs: Main docs update (#1304)
* Remove template in favor of official samples * Fixed a variable name copy pasta mistake line 35 was _database.GetData() instead of DBService.GetData() * Experimental theme change * Change paragraph, code, heading fonts * Widen viewport * Update DocFX.Plugins.LastModified v1.2.3 * Exclude Discord.API in docs * Add remarks for SocketReaction properties * Add examples for BaseSocketClient.Events * Add additional clarification for some methods * Move IUser and IGuildChannel examples * Clarify several guides samples with notes - Reword TypeReader comment to avoid giving the idea that the sample itself is "obsolete" - Remove CommandException logging comment regarding C#7.0 as the version is now the standard across VS2017 and up - Remove suggestion about handling result in command handler since it is now advised to use CommandExecuted instead + Add additional comment to clarify ctor for DI setup * Add/migrate code examples * Incorporate material design theme License @ https://github.com/ovasquez * Update installation and nightly guide * Fix improper indentations made obvious by the widen viewport * Fix minor grammar issues + Add installation for nightly build using dotnet CLI * Fix nav level indentation * Revise "Your First Bot" article * Merge some paragraphs to avoid clutter while keeping readability * Reword the use of command framework + Add additional warning/note about environment variable * Add additional indent level * Fix indentation text warping * Remove connections sample * Update logging sample Remove redundant part of the sample * Remove mention of RPC * Remove misleading section about commands - Remove command sample from complete snippet * Revise "Your First Bot" command paragraphs * Change wording to hint devs that additional command parser packages may be available, as more and more begin to crop up * Update themes * Add XML docs contribution guidelines Update guidelines * Update CommandExecuted remarks * Fix precondition remarks typo no one saw that ok * Fix permission sample in docfx * Fix IMessageChannel samples * Update docs/_template/light-dark-theme/styles/docfx.vendor.minify.css Co-Authored-By: Still34 <341464@gmail.com> * Update docs/_template/light-dark-theme/styles/material.css Co-Authored-By: Still34 <341464@gmail.com> * Update docs/_template/light-dark-theme/styles/material.css Co-Authored-By: Still34 <341464@gmail.com>
This commit is contained in:
@@ -18,6 +18,10 @@ namespace Discord.WebSocket
|
||||
/// see the derived classes of <see cref="SocketChannel"/> for more details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code language="cs" region="ChannelCreated"
|
||||
/// source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs"/>
|
||||
/// </example>
|
||||
public event Func<SocketChannel, Task> ChannelCreated
|
||||
{
|
||||
add { _channelCreatedEvent.Add(value); }
|
||||
@@ -36,6 +40,10 @@ namespace Discord.WebSocket
|
||||
/// see the derived classes of <see cref="SocketChannel"/> for more details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code language="cs" region="ChannelDestroyed"
|
||||
/// source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs"/>
|
||||
/// </example>
|
||||
public event Func<SocketChannel, Task> ChannelDestroyed {
|
||||
add { _channelDestroyedEvent.Add(value); }
|
||||
remove { _channelDestroyedEvent.Remove(value); }
|
||||
@@ -54,6 +62,10 @@ namespace Discord.WebSocket
|
||||
/// <see cref="SocketChannel"/> for more details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code language="cs" region="ChannelUpdated"
|
||||
/// source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs"/>
|
||||
/// </example>
|
||||
public event Func<SocketChannel, SocketChannel, Task> ChannelUpdated {
|
||||
add { _channelUpdatedEvent.Add(value); }
|
||||
remove { _channelUpdatedEvent.Remove(value); }
|
||||
@@ -74,6 +86,11 @@ namespace Discord.WebSocket
|
||||
/// derived classes of <see cref="SocketMessage"/> for more details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <para>The example below checks if the newly received message contains the target user.</para>
|
||||
/// <code language="cs" region="MessageReceived"
|
||||
/// source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs"/>
|
||||
/// </example>
|
||||
public event Func<SocketMessage, Task> MessageReceived {
|
||||
add { _messageReceivedEvent.Add(value); }
|
||||
remove { _messageReceivedEvent.Remove(value); }
|
||||
@@ -102,6 +119,10 @@ namespace Discord.WebSocket
|
||||
/// <see cref="ISocketMessageChannel"/> parameter.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code language="cs" region="MessageDeleted"
|
||||
/// source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs" />
|
||||
/// </example>
|
||||
public event Func<Cacheable<IMessage, ulong>, ISocketMessageChannel, Task> MessageDeleted {
|
||||
add { _messageDeletedEvent.Add(value); }
|
||||
remove { _messageDeletedEvent.Remove(value); }
|
||||
@@ -134,6 +155,35 @@ namespace Discord.WebSocket
|
||||
}
|
||||
internal readonly AsyncEvent<Func<Cacheable<IMessage, ulong>, SocketMessage, ISocketMessageChannel, Task>> _messageUpdatedEvent = new AsyncEvent<Func<Cacheable<IMessage, ulong>, SocketMessage, ISocketMessageChannel, Task>>();
|
||||
/// <summary> Fired when a reaction is added to a message. </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This event is fired when a reaction is added to a user message. The event handler must return a
|
||||
/// <see cref="Task"/> and accept a <see cref="Cacheable{TEntity,TId}"/>, an
|
||||
/// <see cref="ISocketMessageChannel"/>, and a <see cref="SocketReaction"/> as its parameter.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If caching is enabled via <see cref="DiscordSocketConfig"/>, the
|
||||
/// <see cref="Cacheable{TEntity,TId}"/> entity will contain the original message; otherwise, in event
|
||||
/// that the message cannot be retrieved, the snowflake ID of the message is preserved in the
|
||||
/// <see cref="ulong"/>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The source channel of the reaction addition will be passed into the
|
||||
/// <see cref="ISocketMessageChannel"/> parameter.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The reaction that was added will be passed into the <see cref="SocketReaction"/> parameter.
|
||||
/// </para>
|
||||
/// <note>
|
||||
/// When fetching the reaction from this event, a user may not be provided under
|
||||
/// <see cref="SocketReaction.User"/>. Please see the documentation of the property for more
|
||||
/// information.
|
||||
/// </note>
|
||||
/// </remarks>
|
||||
/// <example>
|
||||
/// <code language="cs" region="ReactionAdded"
|
||||
/// source="..\Discord.Net.Examples\WebSocket\BaseSocketClient.Events.Examples.cs"/>
|
||||
/// </example>
|
||||
public event Func<Cacheable<IUserMessage, ulong>, ISocketMessageChannel, SocketReaction, Task> ReactionAdded {
|
||||
add { _reactionAddedEvent.Add(value); }
|
||||
remove { _reactionAddedEvent.Remove(value); }
|
||||
|
||||
@@ -97,13 +97,15 @@ namespace Discord.WebSocket
|
||||
/// <remarks>
|
||||
/// This method gets the user present in the WebSocket cache with the given condition.
|
||||
/// <note type="warning">
|
||||
/// Sometimes a user may return <c>null</c> due to Discord not sending offline users in large
|
||||
/// guilds (i.e. guild with 100+ members) actively. To download users on startup, consider enabling
|
||||
/// <see cref="DiscordSocketConfig.AlwaysDownloadUsers"/>.
|
||||
/// Sometimes a user may return <c>null</c> due to Discord not sending offline users in large guilds
|
||||
/// (i.e. guild with 100+ members) actively. To download users on startup and to see more information
|
||||
/// about this subject, see <see cref="Discord.WebSocket.DiscordSocketConfig.AlwaysDownloadUsers" />.
|
||||
/// </note>
|
||||
/// <note>
|
||||
/// This method does not attempt to fetch users that the logged-in user does not have access to (i.e.
|
||||
/// users who don't share mutual guild(s) with the current user).
|
||||
/// users who don't share mutual guild(s) with the current user). If you wish to get a user that you do
|
||||
/// not have access to, consider using the REST implementation of
|
||||
/// <see cref="DiscordRestClient.GetUserAsync(System.UInt64,Discord.RequestOptions)" />.
|
||||
/// </note>
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
@@ -114,20 +116,22 @@ namespace Discord.WebSocket
|
||||
/// <summary>
|
||||
/// Gets a user.
|
||||
/// </summary>
|
||||
/// <param name="username">The name of the user.</param>
|
||||
/// <param name="discriminator">The discriminator value of the user.</param>
|
||||
/// <remarks>
|
||||
/// This method gets the user present in the WebSocket cache with the given condition.
|
||||
/// <note type="warning">
|
||||
/// Sometimes a user may return <c>null</c> due to Discord not sending offline users in large
|
||||
/// guilds (i.e. guild with 100+ members) actively. To download users on startup, consider enabling
|
||||
/// <see cref="DiscordSocketConfig.AlwaysDownloadUsers"/>.
|
||||
/// Sometimes a user may return <c>null</c> due to Discord not sending offline users in large guilds
|
||||
/// (i.e. guild with 100+ members) actively. To download users on startup and to see more information
|
||||
/// about this subject, see <see cref="Discord.WebSocket.DiscordSocketConfig.AlwaysDownloadUsers" />.
|
||||
/// </note>
|
||||
/// <note>
|
||||
/// This method does not attempt to fetch users that the logged-in user does not have access to (i.e.
|
||||
/// users who don't share mutual guild(s) with the current user).
|
||||
/// users who don't share mutual guild(s) with the current user). If you wish to get a user that you do
|
||||
/// not have access to, consider using the REST implementation of
|
||||
/// <see cref="DiscordRestClient.GetUserAsync(System.UInt64,Discord.RequestOptions)" />.
|
||||
/// </note>
|
||||
/// </remarks>
|
||||
/// <param name="username">The name of the user.</param>
|
||||
/// <param name="discriminator">The discriminator value of the user.</param>
|
||||
/// <returns>
|
||||
/// A generic WebSocket-based user; <c>null</c> when the user cannot be found.
|
||||
/// </returns>
|
||||
|
||||
@@ -94,7 +94,9 @@ namespace Discord.WebSocket
|
||||
/// Please note that it can be difficult to fill the cache completely on large guilds depending on the
|
||||
/// traffic. If you are using the command system, the default user TypeReader may fail to find the user
|
||||
/// due to this issue. This may be resolved at v3 of the library. Until then, you may want to consider
|
||||
/// overriding the TypeReader and use <see cref="DiscordRestClient.GetGuildUserAsync"/> as a backup.
|
||||
/// overriding the TypeReader and use
|
||||
/// <see cref="DiscordRestClient.GetUserAsync(System.UInt64,Discord.RequestOptions)"/>
|
||||
/// or <see cref="DiscordSocketRestClient.GetGuildUserAsync(ulong, ulong, RequestOptions)"/> as a backup.
|
||||
/// </note>
|
||||
/// </remarks>
|
||||
public bool AlwaysDownloadUsers { get; set; } = false;
|
||||
|
||||
@@ -535,7 +535,7 @@ namespace Discord.WebSocket
|
||||
/// </summary>
|
||||
/// <example>
|
||||
/// The following example creates a new text channel under an existing category named <c>Wumpus</c> with a set topic.
|
||||
/// <code lang="cs">
|
||||
/// <code language="cs">
|
||||
/// var categories = await guild.GetCategoriesAsync();
|
||||
/// var targetCategory = categories.FirstOrDefault(x => x.Name == "wumpus");
|
||||
/// if (targetCategory == null) return;
|
||||
|
||||
@@ -10,6 +10,11 @@ namespace Discord.WebSocket
|
||||
/// <summary>
|
||||
/// Gets the ID of the user who added the reaction.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This property retrieves the snowflake identifier of the user responsible for this reaction. This
|
||||
/// property will always contain the user identifier in event that
|
||||
/// <see cref="Discord.WebSocket.SocketReaction.User" /> cannot be retrieved.
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// A user snowflake identifier associated with the user.
|
||||
/// </returns>
|
||||
@@ -17,6 +22,18 @@ namespace Discord.WebSocket
|
||||
/// <summary>
|
||||
/// Gets the user who added the reaction if possible.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This property attempts to retrieve a WebSocket-cached user that is responsible for this reaction from
|
||||
/// the client. In other words, when the user is not in the WebSocket cache, this property may not
|
||||
/// contain a value, leaving the only identifiable information to be
|
||||
/// <see cref="Discord.WebSocket.SocketReaction.UserId" />.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// If you wish to obtain an identifiable user object, consider utilizing
|
||||
/// <see cref="Discord.Rest.DiscordRestClient" /> which will attempt to retrieve the user from REST.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// A user object where possible; a value is not always returned.
|
||||
/// </returns>
|
||||
|
||||
Reference in New Issue
Block a user