static async Task UpdateHourly(PopeAIDB Context) { while (true) { await Context.UpdateLotteries(lotterycache, Context); await Context.UpdateStats(Context); await Context.UpdateRoleIncomes(planets, false, Context); await Context.UpdateDailyTasks(Context); await Task.Delay(60000); } }
public async Task AddTickets(ulong UserId, ulong amount, ulong planetid, PopeAIDB Context) { string TicketId = $"{planetid}-{UserId}"; LotteryTicket ticket = await Context.LotteryTickets.FirstOrDefaultAsync(x => x.UserId == UserId && x.PlanetId == planetid); if (ticket == null) { ticket = new LotteryTicket(); ticket.Id = TicketId; ticket.PlanetId = planetid; ticket.UserId = UserId; ticket.Tickets = 1; await Context.LotteryTickets.AddAsync(ticket); } else { ticket.Tickets += 1; } await Context.SaveChangesAsync(); }