コード例 #1
0
ファイル: Explain.cs プロジェクト: freza1/Vita3KBot
            public async Task DeleteExplanation([Remainder, Summary("Topic to delete")] string topic)
            {
                var file = ExplanationDirectory.GetFiles().FirstOrDefault(f => f.Name == topic + ".txt");

                if (file == null)
                {
                    await ReplyAsync($"`{topic}` doesn't exist, check your spelling.");

                    return;
                }
                file.Delete();
                await ReplyAsync($"Successfully deleted `{topic}`.");
            }
コード例 #2
0
ファイル: Explain.cs プロジェクト: freza1/Vita3KBot
            public async Task ExplainList()
            {
                List <string> explanations = new List <string>();

                foreach (var explanation in ExplanationDirectory.GetFiles())
                {
                    explanations.Add($"`{explanation.Name.Split(".")[0]}`");
                }
                var ExplainListEmbed = new EmbedBuilder()
                                       .WithTitle("All explanations")
                                       .WithColor(Color.Orange)
                                       .WithDescription(string.Join(", ", explanations))
                                       .Build();

                await ReplyAsync(embed : ExplainListEmbed);
            }