Browse Source

rename serilazation method

pull/2169/head
Cenk Ergen 3 years ago
parent
commit
fdf20f591c
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      src/Discord.Net.Interactions/InteractionService.cs

+ 11
- 2
src/Discord.Net.Interactions/InteractionService.cs View File

@@ -854,8 +854,17 @@ namespace Discord.Interactions
if (!constraints.Any(x => x.IsAssignableFrom(targetType)))
throw new InvalidOperationException($"This generic class does not support type {targetType.FullName}");

_genericTypeConverters[targetType] = converterType;
}
/// <summary>
/// Serialize an object using a <see cref="TypeReader"/> into a <see cref="string"/> to be placed in a Component CustomId.
/// </summary>
/// <typeparam name="T">Type of the object to be serialized.</typeparam>
/// <param name="obj">Object to be serialized.</param>
/// <param name="services">Services that will be passed on to the TypeReader.</param>
/// <returns>
/// A task representing the conversion process. The task result contains the result of the conversion.
/// </returns>
public Task<string> SerializeValueAsync<T>(T obj, IServiceProvider services = null) =>
_typeReaderMap.Get(typeof(T), services).SerializeAsync(obj);

/// <summary>
/// Loads and caches an <see cref="ModalInfo"/> for the provided <see cref="IModal"/>.


Loading…
Cancel
Save