Rework the output of the /choose command to show all the choices that the user has entered; which are somewhat lost with / commands, as others can't see what the user entered without an additional mouseclick

This commit is contained in:
Daan Boerlage 2021-11-16 00:40:19 +01:00
parent d03525d363
commit 0e5785e3a1
Signed by: daan
GPG key ID: FCE070E1E4956606

View file

@ -1,8 +1,8 @@
using System.Text;
using Geekbot.Interactions;
using Geekbot.Interactions.ApplicationCommand;
using Geekbot.Interactions.Request;
using Geekbot.Interactions.Response;
using Localization = Geekbot.Core.Localization;
namespace Geekbot.Web.Commands;
@ -45,6 +45,14 @@ public class Choose : InteractionBase
var choicesArray = options.Split(separator);
var choice = new Random().Next(choicesArray.Length);
return Task.FromResult(SimpleResponse(string.Format(Localization.Choose.Choice, choicesArray[choice].Trim())));
var sb = new StringBuilder();
for (var i = 0; i < choicesArray.Length; i++)
{
var o = choicesArray[i].Trim();
sb.AppendLine(i == choice ? $"**__{o}__**" : o);
}
return Task.FromResult(SimpleResponse(sb.ToString()));
}
}