Esempio n. 1
0
 private StoreCommands(DiscordSocketClient client, RokiContext context, ICurrencyService currency, IConfigurationService config)
 {
     _client   = client;
     _context  = context;
     _currency = currency;
     _config   = config;
 }
Esempio n. 2
0
 public Xp(IHttpClientFactory http, RokiContext context, IRedisCache cache, IConfigurationService config)
 {
     _http    = http;
     _context = context;
     _config  = config;
     _cache   = cache.Redis.GetDatabase();
 }
Esempio n. 3
0
 public TradingService(IHttpClientFactory factory, IRokiConfig config, RokiContext context, ICurrencyService currency, IConfigurationService service)
 {
     _factory  = factory;
     _config   = config;
     _context  = context;
     _currency = currency;
     _service  = service;
 }
Esempio n. 4
0
        public async Task InvokeAsync(HttpContext context, RokiContext dbContext)
        {
            if (!context.Request.Path.StartsWithSegments("/manage"))
            {
                await _next(context);

                return;
            }

            string[] route = context.Request.Path.ToString().Split('/');
            if (route.Length < 3)
            {
                await _next(context);

                return;
            }

            if (!ulong.TryParse(route[2], out ulong guildId))
            {
                context.Response.Redirect("/manage");
                await context.Response.CompleteAsync();

                return;
            }

            ulong userId = ulong.Parse(context.User.FindFirstValue("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"));

            // check if user is owner or is a moderator of server
            // todo admin bypass?
            if (!await dbContext.Guilds.AsNoTracking().AnyAsync(x => x.Id == guildId && (x.OwnerId == userId || x.Moderators.Contains((long)userId))))
            {
                context.Response.Redirect("/manage");
                await context.Response.CompleteAsync();

                return;
            }

            await _next(context);
        }
Esempio n. 5
0
 public QuoteCommands(RokiContext context, IConfigurationService config)
 {
     _context = context;
     _config  = config;
 }
Esempio n. 6
0
 public SettingsController(RokiContext context)
 {
     _context = context;
 }
Esempio n. 7
0
 public Currency(RokiContext context, ICurrencyService currency, IConfigurationService config)
 {
     _context  = context;
     _currency = currency;
     _config   = config;
 }
Esempio n. 8
0
 public PortfolioService(IHttpClientFactory factory, IRokiConfig config, RokiContext context)
 {
     _factory = factory;
     _config  = config;
     _context = context;
 }
Esempio n. 9
0
 public GuildController(RokiContext context, DiscordService discordService)
 {
     _context        = context;
     _discordService = discordService;
 }