示例#1
0
        public async Task Create([Remainder] string rawJsonInput = "")
        {
            byte[]       byteArray = Encoding.UTF8.GetBytes(rawJsonInput);
            MemoryStream stream    = new MemoryStream(byteArray);

            try
            {
                JsonDocument json = await JsonDocument.ParseAsync(stream);

                var embed = await _service.BuildAsync(json);
                await ReplyAsync(embed : embed);

                await stream.DisposeAsync();

                await Task.Run(() => json.Dispose());
            }
            catch (Exception ex)
            {
                await _log.Log(new LogMessage(LogSeverity.Error, "input", ex.Message, ex));
            }
        }