a bit faster OwnerOnly checking
This commit is contained in:
parent
85a00f6123
commit
fb837235a7
@ -1,4 +1,6 @@
|
|||||||
using Discord;
|
using Discord;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
namespace NadekoBot.Services
|
namespace NadekoBot.Services
|
||||||
{
|
{
|
||||||
@ -9,7 +11,7 @@ namespace NadekoBot.Services
|
|||||||
|
|
||||||
string Token { get; }
|
string Token { get; }
|
||||||
string GoogleApiKey { get; }
|
string GoogleApiKey { get; }
|
||||||
ulong[] OwnerIds { get; }
|
ImmutableHashSet<ulong> OwnerIds { get; }
|
||||||
string MashapeKey { get; }
|
string MashapeKey { get; }
|
||||||
string LoLApiKey { get; }
|
string LoLApiKey { get; }
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ using Discord;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
namespace NadekoBot.Services.Impl
|
namespace NadekoBot.Services.Impl
|
||||||
{
|
{
|
||||||
@ -21,7 +23,7 @@ namespace NadekoBot.Services.Impl
|
|||||||
|
|
||||||
public string Token { get; }
|
public string Token { get; }
|
||||||
|
|
||||||
public ulong[] OwnerIds { get; }
|
public ImmutableHashSet<ulong> OwnerIds { get; }
|
||||||
|
|
||||||
public string LoLApiKey { get; }
|
public string LoLApiKey { get; }
|
||||||
public string OsuApiKey { get; }
|
public string OsuApiKey { get; }
|
||||||
@ -61,7 +63,7 @@ namespace NadekoBot.Services.Impl
|
|||||||
Token = data[nameof(Token)];
|
Token = data[nameof(Token)];
|
||||||
if (string.IsNullOrWhiteSpace(Token))
|
if (string.IsNullOrWhiteSpace(Token))
|
||||||
throw new ArgumentNullException(nameof(Token), "Token is missing from credentials.json or Environment varibles.");
|
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)];
|
LoLApiKey = data[nameof(LoLApiKey)];
|
||||||
GoogleApiKey = data[nameof(GoogleApiKey)];
|
GoogleApiKey = data[nameof(GoogleApiKey)];
|
||||||
MashapeKey = data[nameof(MashapeKey)];
|
MashapeKey = data[nameof(MashapeKey)];
|
||||||
|
Loading…
Reference in New Issue
Block a user