public async Task DailyCommand()
        {
            int amount = 1000;

            if (await cooldown.CheckIfRecordExist(Context.User.Id))
            {
                CooldownObject userCooldowns = await cooldown.GetCooldowns(Context.User.Id);

                Console.WriteLine(userCooldowns.Daily);
                if (Convert.ToInt64(DateTime.Now.Millisecond) <= userCooldowns.Daily)
                {
                    var time = userCooldowns.Daily - Convert.ToInt64(DateTime.Now.Millisecond);
                    Console.WriteLine(time);
                    await Context.Channel.SendMessageAsync($"Sorry, but you are still on a cooldown for this command. Please wait another `{(new DateTime(time).Hour == 1 ? $"{new DateTime(time).Minute} minutes" : $"{new DateTime(time).Hour} hours")}`");

                    return;
                }
            }
            if (!await UserDb.CheckIfRecordExist(Context.User.Id))
            {
                await UserDb.CreateUserProfile(new UserObject()
                {
                    Id      = Context.User.Id,
                    Balance = amount
                });
            }
            else
            {
                UserObject user = await UserDb.GetUserProfile(Context.User.Id);

                user.Balance = user.Balance + amount;
                await UserDb.UpdateUserProfile(user);
            }
            var embed = new EmbedBuilder()
            {
                Color       = new Color(0xffb6c1),
                Title       = $"{Context.User.Username}'s Daily Reward!!!",
                Description = $"{Context.User.Username} got {amount} <a:FLflower2:678622764080431114> flowers as their daily reward!"
            };
            CooldownObject _userCooldowns = await cooldown.GetCooldowns(Context.User.Id);

            _userCooldowns.Daily = _userCooldowns.Daily + 86400000; // 86400000 milliseconds = 1 day
            await cooldown.UpdateCooldowns(_userCooldowns);

            await Context.Channel.SendMessageAsync(embed : embed.Build());
        }
Example #2
0
    public override void ViewRender()
    {
        base.ViewRender();

        var daughters = Companies.GetDaughters(MyCompany, Q);

        if (daughters.Length > 0)
        {
            var tasks = Cooldowns.GetCooldowns(Q, daughters[0].company.Id);

            Debug.Log("Tasks Count " + tasks.Count());

            SetItems(tasks);
        }
        else
        {
            SetItems(new GameEntity[0]);
        }
    }