コード例 #1
0
        public async Task StreetsAsync(CommandContext ctx)
        {
            int change = GFRandom.Generator.NextBool() ? GFRandom.Generator.Next(1000, 5000) : -GFRandom.Generator.Next(5, 2500);

            using (DatabaseContext db = this.Database.CreateContext()) {
                await db.ModifyBankAccountAsync(ctx.User.Id, ctx.Guild.Id, b => b + change);

                await db.SaveChangesAsync();
            }

            await ctx.RespondAsync(embed : new DiscordEmbedBuilder {
                Description = $"{ctx.Member.Mention} {WorkHandler.GetWorkStreetsString(change, this.Shared.GetGuildConfig(ctx.Guild.Id).Currency)}",
                Color       = change > 0 ? DiscordColor.PhthaloGreen : DiscordColor.IndianRed
            }.WithFooter("Who needs dignity?", ctx.Member.AvatarUrl).Build());
        }