Вы достигли своей логики только с одним уровнем if
с.
if
else if
else if
else
Кроме того, воспользуйтесь преимуществом .ToLower()
строки Как только вы сделаете эти изменения, это может бытьпроще отладить в чем проблема.
Шаг 2
string t = message.Text.ToLower();
if (t.StartsWith("1") || t.Contains("CUV Residencial".ToLower()))
{
await context.PostAsync("1");
}
else if (t.StartsWith("2") || t.Contains("CUV de Interes Social".ToLower()))
{
await context.PostAsync("2");
}
else if (t.StartsWith("3") || t.Contains("CUV Media".ToLower()))
{
await context.PostAsync("3");
}
else
{
await context.PostAsync("Opcion no Valida");
(...)
}
Шаг 1
string t = message.Text.ToLower();
if ((t == "1.- CUV Residencial".ToLower()) || (t == "1".ToLower())
|| (t == "1.-".ToLower()) || (t == "CUV residencial".ToLower()))
{
await context.PostAsync("1");
}
else if ((t == "2.- CUV de Interes Social".ToLower()) || (t == "2".ToLower())
|| (t == "2.-".ToLower()) || (t == "CUV de Interes Social".ToLower()))
{
await context.PostAsync("2");
}
else if ((t == "3.- CUV Media".ToLower()) || (t == "3.-".ToLower()) || (t == "3".ToLower())
|| (t == "CUV Media".ToLower()))
{
await context.PostAsync("3");
}
else
{
await context.PostAsync("Opcion no Valida");
(...)
}