public async Task SVIDAll(CommandContext ctx, string Inputname) { Dictionary <string, string> svids = await SVTools.NameToSVID(Inputname); if (svids != null) { if (svids.Count == 1) { KeyValuePair <string, string> svid = svids.First(); await ctx.ReplyAsync($"{svid.Key}'s SpookVooper Name: {svid.Value}").ConfigureAwait(false); } else { string msgCont = null; foreach (KeyValuePair <string, string> svid in svids) { msgCont += $"\n{svid.Key}: {svid.Value}"; } await ctx.ReplyAsync($"List of SVIDs: {msgCont}").ConfigureAwait(false); } } else { await ctx.ReplyAsync($"This name does not match to any entity (user/group)!").ConfigureAwait(false); } }
public async Task Balance(CommandContext ctx, string Input) { if (Input[0].Equals('u') || Input[0].Equals('g')) { Entity entity = new Entity(Input, null); await ctx.ReplyAsync($"{await SVTools.SVIDToName(Input)}'s Balance: ¢{Math.Round(await entity.GetBalanceAsync(), 2, MidpointRounding.ToZero)}").ConfigureAwait(false); } else { Dictionary <string, string> svids = await SVTools.NameToSVID(Input); if (svids != null) { if (svids.Count == 1) { KeyValuePair <string, string> svid = svids.First(); Entity entity = new Entity(svid.Value, ""); await ctx.ReplyAsync($"{Input}'s Balance: ¢{Math.Round(await entity.GetBalanceAsync(), 2, MidpointRounding.ToZero)}").ConfigureAwait(false); } else { string msgCont = null; foreach (KeyValuePair <string, string> svid in svids) { Entity entity = new Entity(svid.Value, ""); msgCont += $"\n{svid.Key}: ¢{Math.Round(await entity.GetBalanceAsync(), 2, MidpointRounding.ToZero)}"; } await ctx.ReplyAsync($"List of Balances for {Input}: {msgCont}").ConfigureAwait(false); } } else { await ctx.ReplyAsync($"This name does not match to any entity (user/group) SVID or Name!").ConfigureAwait(false); } } }
public async Task Name(CommandContext ctx, string InputSVID) { await ctx.ReplyAsync($"Name: {await SVTools.SVIDToName(InputSVID)}").ConfigureAwait(false); }
static public async Task HandleTransactionAsync(Transaction transaction) { DateTime time = DateTime.Now; //tax calculation float tax = 0; switch (transaction.Tax) { case ApplicableTax.CapitalGains: tax = (float)transaction.Amount * ((float)0.10 / 100); break; case ApplicableTax.Corporate: tax = (float)transaction.Amount * ((float)2.50 / 100); break; case ApplicableTax.Payroll: tax = (float)transaction.Amount * ((float)1.50 / 100); break; case ApplicableTax.Sales: tax = (float)transaction.Amount * ((float)2.50 / 100); break; } // text base string text; if (!transaction.Force) { text = $@"{time.Day}/{time.Month}/{time.Year} {time.Hour}:{time.Minute}:{time.Second} {time.Millisecond}ms sent ¢{transaction.Amount} from {transaction.FromAccount} ({await SVTools.SVIDToName(transaction.FromAccount)}) to {transaction.ToAccount} ({await SVTools.SVIDToName(transaction.ToAccount)}) as {transaction.Detail}"; } else { text = $@"{time.Day}/{time.Month}/{time.Year} {time.Hour}:{time.Minute}:{time.Second} {time.Millisecond}ms force sent ¢{transaction.Amount} from {transaction.FromAccount} ({await SVTools.SVIDToName(transaction.FromAccount)}) to {transaction.ToAccount} ({await SVTools.SVIDToName(transaction.ToAccount)}) as {transaction.Detail}"; } // embed base DiscordEmbedBuilder embed = new DiscordEmbedBuilder { Title = $"¢{transaction.Amount} {transaction.Detail} from {await SVTools.SVIDToName(transaction.FromAccount)} to {await SVTools.SVIDToName(transaction.ToAccount)}", Description = $"{time.Day}/{time.Month}/{time.Year} {time.Hour}:{time.Minute}:{time.Second} {time.Millisecond}ms", Color = new DiscordColor("#00eb08") }; embed.AddField("SVIDs", $"From: {transaction.FromAccount}\nTo: {transaction.ToAccount}"); // additions to base if (tax != 0) { text = $@"{text} with a tax of {tax} ({transaction.Tax})"; embed.AddField("Tax", $"Amount: {tax}\nType: {transaction.Tax}"); } if (transaction.Force) { embed.Description = $"Forced {embed.Description} "; } foreach (var hook in hooks) { DiscordChannel channel = await client.GetChannelAsync(hook.Value.Item1); if (hook.Value.Item2 == "none") { await channel.SendMessageAsync(text).ConfigureAwait(false); } else if (hook.Value.Item2 == "embed") { await channel.SendMessageAsync(embed : embed).ConfigureAwait(false); } else { await channel.SendMessageAsync($@"Type does not exist!").ConfigureAwait(false); } } }