@@ -82,8 +82,8 @@ namespace Discord.Commands
/// Represents all entity type reader <see cref="Type" />s loaded within <see cref="CommandService"/>.
/// Represents all entity type reader <see cref="Type" />s loaded within <see cref="CommandService"/>.
/// </summary>
/// </summary>
/// <returns>
/// <returns>
/// A <see cref="ILookup{TKey, TElement}"/> that the key is the object type to be read by the <see cref="TypeReader"/>
/// and the element is the type of the <see cref="TypeReader"/> generic definition.
/// A <see cref="ILookup{TKey, TElement}"/>; the key is the object type to be read by the <see cref="TypeReader"/>,
/// while the element is the type of the <see cref="TypeReader"/> generic definition.
/// </returns>
/// </returns>
public ILookup<Type, Type> EntityTypeReaders => _userEntityTypeReaders.SelectMany(x => x.Value.Select(y => new { x.Key, TypeReaderType = y })).ToLookup(x => x.Key, y => y.TypeReaderType);
public ILookup<Type, Type> EntityTypeReaders => _userEntityTypeReaders.SelectMany(x => x.Value.Select(y => new { x.Key, TypeReaderType = y })).ToLookup(x => x.Key, y => y.TypeReaderType);
@@ -368,13 +368,10 @@ namespace Discord.Commands
/// <example>
/// <example>
/// <para>The following example adds a custom entity reader to this <see cref="CommandService"/>.</para>
/// <para>The following example adds a custom entity reader to this <see cref="CommandService"/>.</para>
/// <code language="cs" region="AddEntityTypeReader"
/// <code language="cs" region="AddEntityTypeReader"
/// source="..\..\..\ Discord.Net.Examples\Commands\CommandService.Examples.cs" />
/// source="..\Discord.Net.Examples\Commands\CommandService.Examples.cs" />
/// </example>
/// </example>
/// <typeparam name="T">The object type to be read by the <see cref="TypeReader"/>.</typeparam>
/// <typeparam name="T">The object type to be read by the <see cref="TypeReader"/>.</typeparam>
/// <param name="typeReaderGenericType">
/// A <see cref="Type" /> that is a generic type definition with a single open argument
/// of the <see cref="TypeReader" /> to be added.
/// </param>
/// <param name="typeReaderGenericType">A generic type definition (with one open argument) of the <see cref="TypeReader" />.</param>
public void AddEntityTypeReader<T>(Type typeReaderGenericType)
public void AddEntityTypeReader<T>(Type typeReaderGenericType)
=> AddEntityTypeReader(typeof(T), typeReaderGenericType);
=> AddEntityTypeReader(typeof(T), typeReaderGenericType);
/// <summary>
/// <summary>
@@ -382,10 +379,7 @@ namespace Discord.Commands
/// object type.
/// object type.
/// </summary>
/// </summary>
/// <param name="type">A <see cref="Type" /> instance for the type to be read.</param>
/// <param name="type">A <see cref="Type" /> instance for the type to be read.</param>
/// <param name="typeReaderGenericType">
/// A <see cref="Type" /> that is a generic type definition with a single open argument
/// of the <see cref="TypeReader" /> to be added.
/// </param>
/// <param name="typeReaderGenericType">A generic type definition (with one open argument) of the <see cref="TypeReader" />.</param>
public void AddEntityTypeReader(Type type, Type typeReaderGenericType)
public void AddEntityTypeReader(Type type, Type typeReaderGenericType)
{
{
if (!typeReaderGenericType.IsGenericTypeDefinition)
if (!typeReaderGenericType.IsGenericTypeDefinition)
@@ -406,6 +400,11 @@ namespace Discord.Commands
/// If <typeparamref name="T" /> is a <see cref="ValueType" />, a nullable <see cref="TypeReader" /> will
/// If <typeparamref name="T" /> is a <see cref="ValueType" />, a nullable <see cref="TypeReader" /> will
/// also be added.
/// also be added.
/// </summary>
/// </summary>
/// <example>
/// <para>The following example adds a custom entity reader to this <see cref="CommandService"/>.</para>
/// <code language="cs" region="AddEntityTypeReader2"
/// source="..\Discord.Net.Examples\Commands\CommandService.Examples.cs" />
/// </example>
/// <typeparam name="T">The object type to be read by the <see cref="TypeReader"/>.</typeparam>
/// <typeparam name="T">The object type to be read by the <see cref="TypeReader"/>.</typeparam>
/// <param name="reader">An instance of the <see cref="TypeReader" /> to be added.</param>
/// <param name="reader">An instance of the <see cref="TypeReader" /> to be added.</param>
/// <param name="replaceDefault">
/// <param name="replaceDefault">