Ejemplo n.º 1
0
        public async Task RedeemDaily()
        {
            var  user      = _userRepo.GetByID(Context.User.Id);
            bool firstTime = false;

            if (user == null)
            {
                user      = CheckIfExistAndCreate();
                firstTime = true;
            }

            if (IsElligable(user) || firstTime)
            {
                user.AddAmount(CurrencyEnum.Entropy, RedeemAmount);
                user.RedeemedTime = DateTime.Now;

                _userRepo.SaveChanges();

                var emb = await CurrencyEmbedBuilder.MakeRedeemEmbed(Context, user, RedeemAmount);

                await Context.Channel.SendMessageAsync(embed : emb.Build());
            }
            else
            {
                var diff = user.RedeemedTime.AddDays(1).Subtract(DateTime.Now);
                await Context.Channel.SendMessageAsync("You can't do that yet please wait another" +
                                                       $": {diff.ToString(@"hh\hmm\mss\s")}");
            }
        }