public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
            {
                var discord = await discordHelper.LoginBot();

                if (discord == null)
                {
                    context.Result = new NotFoundObjectResult("Can't connect to Discord.");
                    return;
                }

                var httpContext = context.HttpContext;
                var discordId   = DiscordHelper.GetDiscordUserIdFor(httpContext.User);
                var botUser     = await db.BotUsers.FirstOrDefaultAsync(u => u.DiscordId == discordId);

                if (botUser == null)
                {
                    botUser = new BotUser {
                        DiscordId = discordId, Role = Role.User
                    };
                    db.BotUsers.Add(botUser);
                    db.SaveChanges();
                }

                httpContext.Items[typeof(BotUser)] = botUser;

                var resultContext = await next();
            }
 public RequiresDiscordFilterImpl(DiscordHelper discordHelper, ProxyDataContext db)
 {
     this.discordHelper = discordHelper;
     this.db            = db;
 }