Skip to content
This repository was archived by the owner on Nov 24, 2022. It is now read-only.

Commit 0021c46

Browse files
committed
Order snippets by name in slash commands
1 parent fbc605a commit 0021c46

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

TabletBot.Discord/SlashCommands/SnippetSlashCommands.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,16 @@ private List<ApplicationCommandOptionChoiceProperties> GetSnippets()
231231
return new List<ApplicationCommandOptionChoiceProperties>();
232232
}
233233

234-
return _settings.Snippets.Select(s =>
235-
new ApplicationCommandOptionChoiceProperties
234+
var query = from snippet in _settings.Snippets
235+
let option = new ApplicationCommandOptionChoiceProperties
236236
{
237-
Name = $"{s.Snippet}: {s.Title}",
238-
Value = s.Snippet
237+
Name = $"{snippet.Snippet}: {snippet.Title}",
238+
Value = snippet.Snippet
239239
}
240-
).ToList();
240+
orderby option.Name
241+
select option;
242+
243+
return query.ToList();
241244
}
242245
}
243246
}

0 commit comments

Comments
 (0)