a bit faster OwnerOnly checking

This commit is contained in:
Kwoth 2017-02-13 10:28:49 +01:00
parent 85a00f6123
commit fb837235a7
2 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,6 @@
using Discord;
using System.Collections.Generic;
using System.Collections.Immutable;
namespace NadekoBot.Services
{
@ -9,7 +11,7 @@ namespace NadekoBot.Services
string Token { get; }
string GoogleApiKey { get; }
ulong[] OwnerIds { get; }
ImmutableHashSet<ulong> OwnerIds { get; }
string MashapeKey { get; }
string LoLApiKey { get; }

View File

@ -5,6 +5,8 @@ using Discord;
using System.Linq;
using NLog;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;
using System.Collections.Immutable;
namespace NadekoBot.Services.Impl
{
@ -21,7 +23,7 @@ namespace NadekoBot.Services.Impl
public string Token { get; }
public ulong[] OwnerIds { get; }
public ImmutableHashSet<ulong> OwnerIds { get; }
public string LoLApiKey { get; }
public string OsuApiKey { get; }
@ -61,7 +63,7 @@ namespace NadekoBot.Services.Impl
Token = data[nameof(Token)];
if (string.IsNullOrWhiteSpace(Token))
throw new ArgumentNullException(nameof(Token), "Token is missing from credentials.json or Environment varibles.");
OwnerIds = data.GetSection("OwnerIds").GetChildren().Select(c => ulong.Parse(c.Value)).ToArray();
OwnerIds = data.GetSection("OwnerIds").GetChildren().Select(c => ulong.Parse(c.Value)).ToImmutableHashSet();
LoLApiKey = data[nameof(LoLApiKey)];
GoogleApiKey = data[nameof(GoogleApiKey)];
MashapeKey = data[nameof(MashapeKey)];