Ejemplo n.º 1
0
        public static async Task <WheelOutcome> GetLastOutcome(UserSetting.Outcome type, long userId, bool?isUserReport = null, DiscordContext context = null)
        {
            var dispose = context == null;

            if (context == null)
            {
#pragma warning disable IDE0068 // Use recommended dispose pattern
                context = new DiscordContext();
#pragma warning restore IDE0068 // Use recommended dispose pattern
            }

            WheelOutcome outcome;

            if (isUserReport != null)
            {
                outcome = await context.WheelOutcome.OrderByDescending(outcome => outcome.Time)
                          .FirstOrDefaultAsync(outcome => outcome.UserId == userId &&
                                               outcome.IsUserReport == (isUserReport.Value == false ? 0 : 1) &&
                                               type.HasFlag((UserSetting.Outcome)outcome.Type));
            }
            else
            {
                outcome = await context.WheelOutcome.OrderByDescending(outcome => outcome.Time)
                          .FirstOrDefaultAsync(outcome => outcome.UserId == userId &&
                                               type.HasFlag((UserSetting.Outcome)outcome.Type));
            }

            if (dispose)
            {
                context.Dispose();
            }

            return(outcome);
        }
Ejemplo n.º 2
0
        private async Task <UserSetting.Outcome> CheckDenial(CommandContext ctx, Users user, UserSetting.Outcome outcome)
        {
            if (user.DenialTime != null && user.DenialTime > DateTime.Now)
            {
                if (outcome.HasFlag(UserSetting.Outcome.O****m) ||
                    outcome.HasFlag(UserSetting.Outcome.Ruin))
                {
                    await ctx.RespondAsync(
                        "Haha, I would\'ve let you cum this time, but since you\'re still denied, "
                        + $"that won't happen {DiscordEmoji.FromName(ctx.Client, Config.Emojis.Blush)}.\n" +
                        "As a punishment, you\'re gonna do your Task anyways though:");
                }
                else
                {
                    await ctx.RespondAsync(
                        "Well, i told you, that you\'d be denied now.\n"
                        + "You still want to do something? Hmm... let's see...");
                }

                outcome = UserSetting.Outcome.Denial | UserSetting.Outcome.Edge;
            }

            return(outcome);
        }