diff --git a/ChaosBot/WebServer/App/CustomCommandApi.cs b/ChaosBot/WebServer/App/CustomCommandApi.cs index cec548e..86d5e7d 100644 --- a/ChaosBot/WebServer/App/CustomCommandApi.cs +++ b/ChaosBot/WebServer/App/CustomCommandApi.cs @@ -30,7 +30,9 @@ namespace ChaosBot.WebServer.App .Where(cc => cc.DiscordGuildId == guildId) .ToList(); - return Json(customCommands); + List response = customCommands.Select(e => new CustomCommandResponse(e)).ToList(); + + return Json(response); } [HttpPost] @@ -79,4 +81,4 @@ namespace ChaosBot.WebServer.App return NoContent(); } } -} \ No newline at end of file +} diff --git a/ChaosBot/WebServer/Models/CustomCommandResponse.cs b/ChaosBot/WebServer/Models/CustomCommandResponse.cs new file mode 100644 index 0000000..524b13b --- /dev/null +++ b/ChaosBot/WebServer/Models/CustomCommandResponse.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; +using ChaosBot.Models; + +namespace ChaosBot.WebServer.Models +{ + class CustomCommandResponse + { + [Required] + public string DiscordGuildId { get; } + [Required] + [MaxLength(128)] + public string Command { get; } + [Required] + public CustomCommandType Type { get; } + [Required] + public string Content { get; } + + public CustomCommandResponse(CustomCommand command) + { + DiscordGuildId = command.DiscordGuildId.ToString(); + Command = command.Command; + Type = command.Type; + Content = command.Content; + } + } +}