public async Task GenerateCode(ProType type, int durationDays, int useAmount, int codeAmount, string prefix, string id, int codeExpiresInDays, [Remainder] string str = "") { prefix = prefix == "0" ? null : prefix; id = id == "0" ? null : id; DateTime?expires = null; if (codeExpiresInDays != 0) { expires = DateTime.Now.AddDays(codeExpiresInDays); } var res = await PremiumCodeDb.GenerateCodes(type, durationDays, useAmount, codeAmount, prefix, id, expires); var example = res.FirstOrDefault(); string desc = "```yaml\n"; foreach (var prop in example.GetProperties()) { desc += prop.Key + ": " + prop.Value + "\n"; } desc += "```\n```yaml\n"; foreach (var code in res.Select(x => x.Id)) { desc += code + "\n"; } desc += "```"; await Context.Channel.SendMessageAsync(desc); }
public async Task GenerateCode(string code, [Remainder] string str = "") { string desc = "```yaml\n"; var example = await PremiumCodeDb.TestCode(code); foreach (var prop in example.GetProperties()) { desc += prop.Key + ": " + prop.Value + "\n"; } desc += "```"; await Context.Channel.SendMessageAsync(desc); }