예제 #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);
            }