|
|
@@ -910,13 +910,22 @@ namespace Discord.Interactions |
|
|
|
/// </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> |
|
|
|
/// <param name="services">Services that will be passed on to the <see cref="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) => |
|
|
|
_typeReaderMap.Get(typeof(T), services).SerializeAsync(obj, services); |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// Serialize and format multiple objects into a Custom Id string. |
|
|
|
/// </summary> |
|
|
|
/// <param name="format">A composite format string.</param> |
|
|
|
/// <param name="services">>Services that will be passed on to the <see cref="TypeReader"/>s.</param> |
|
|
|
/// <param name="args">Objects to be serialized.</param> |
|
|
|
/// <returns> |
|
|
|
/// A task representing the conversion process. The task result contains the result of the conversion. |
|
|
|
/// </returns> |
|
|
|
public async Task<string> GenerateCustomIdStringAsync(string format, IServiceProvider services, params object[] args) |
|
|
|
{ |
|
|
|
var serializedValues = new string[args.Length]; |
|
|
@@ -925,7 +934,7 @@ namespace Discord.Interactions |
|
|
|
{ |
|
|
|
var arg = args[i]; |
|
|
|
var typeReader = _typeReaderMap.Get(arg.GetType(), null); |
|
|
|
var result = await typeReader.SerializeAsync(arg, services); |
|
|
|
var result = await typeReader.SerializeAsync(arg, services).ConfigureAwait(false); |
|
|
|
serializedValues[i] = result; |
|
|
|
} |
|
|
|
|
|
|
|