diff options
author | TrueDoctor <d-kobert@web.de> | 2018-04-09 14:13:28 +0200 |
---|---|---|
committer | TrueDoctor <d-kobert@web.de> | 2018-04-09 14:13:28 +0200 |
commit | 5cb8346a6a3ccc55295c00ac333e410629ff7c42 (patch) | |
tree | 1603fdf24f1ead61cf7dd23c09a9784cfb1c780e /DiscoBot/Commands/List.cs | |
parent | e49ac2778bb6d38517f14447c0675df354552528 (diff) | |
parent | 4ca7291ebee440d9f3ef2a1643d8d01b29006459 (diff) |
Merge branch 'Reset'
Diffstat (limited to 'DiscoBot/Commands/List.cs')
-rw-r--r-- | DiscoBot/Commands/List.cs | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/DiscoBot/Commands/List.cs b/DiscoBot/Commands/List.cs new file mode 100644 index 0000000..9eac3a1 --- /dev/null +++ b/DiscoBot/Commands/List.cs @@ -0,0 +1,76 @@ +namespace DiscoBot.Commands +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + + using DiscoBot.Auxiliary; + using DiscoBot.Characters; + + using Discord.Commands; + + public class List : ModuleBase + { + [Command("list"), Summary("gibt eine Auflistung aus")] + public async Task ListAsync([Summary("Aktion")] string prop) + { + var res = new List<string>(); + switch (prop.ToLower()) + { + case "chars": + case "Chars": + res.AddRange(Dsa.Chars.Select(x => x.Name)); + break; + case "t": + case "ta": + case "talent": + case "zauber": + res.AddRange( + ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))) + .Talente.Select(s => s.Name + "\t " + s.Value + "\t " + s.Probe)); + break; + case "w": + case "waffe": + case "waffen": + res.AddRange( + ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))) + .Kampftalente.Select(s => s.Name)); + break; + case "fern": + res.AddRange( + ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))) + .Talente.Select(s => s.Name)); + break; + case "v": + case "vt": + case "vor": + case "vorteil": + res.AddRange( + ((Character)Dsa.Chars.Find(x => x.Name.Equals(Dsa.Relation[this.Context.User.Username]))) + .Vorteile + .Select(s => s.Name + "\t " + (s.Value == 0 ? string.Empty : s.Value.ToString()))); + break; + + default: + res.Add($"Kommando {prop} nicht gefunden"); + break; + } + + var sb = new StringBuilder(); + foreach (string re in res) + { + if (sb.Length + re.Length > 1798) + { + await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90)); + sb.Clear(); + } + + sb.AppendLine(re); + } + + await this.ReplyTimedAsync(sb.ToString(), TimeSpan.FromSeconds(90)); + } + } +} |