Fix CommandHandler config service requirement
This commit is contained in:
parent
cb335bd393
commit
5ae3d7599d
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ChaosBot.Database.Repository;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Discord;
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
@ -12,7 +13,6 @@ namespace ChaosBot.Discord.Services
|
|||||||
{
|
{
|
||||||
public class CommandHandler
|
public class CommandHandler
|
||||||
{
|
{
|
||||||
private readonly IConfiguration _config;
|
|
||||||
private readonly CommandService _commands;
|
private readonly CommandService _commands;
|
||||||
private readonly DiscordSocketClient _client;
|
private readonly DiscordSocketClient _client;
|
||||||
private readonly IServiceProvider _services;
|
private readonly IServiceProvider _services;
|
||||||
@ -22,7 +22,6 @@ namespace ChaosBot.Discord.Services
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_config = services.GetRequiredService<IConfiguration>();
|
|
||||||
_commands = services.GetRequiredService<CommandService>();
|
_commands = services.GetRequiredService<CommandService>();
|
||||||
_client = services.GetRequiredService<DiscordSocketClient>();
|
_client = services.GetRequiredService<DiscordSocketClient>();
|
||||||
_services = services;
|
_services = services;
|
||||||
@ -54,7 +53,7 @@ namespace ChaosBot.Discord.Services
|
|||||||
|
|
||||||
var argPos = 0;
|
var argPos = 0;
|
||||||
|
|
||||||
char prefix = Char.Parse(_config["Discord:Prefix"]);
|
char prefix = Char.Parse(ConfigurationRepository.GetValue<string>("Discord:Prefix"));
|
||||||
|
|
||||||
if (!(message.HasMentionPrefix(_client.CurrentUser, ref argPos) || message.HasCharPrefix(prefix, ref argPos)))
|
if (!(message.HasMentionPrefix(_client.CurrentUser, ref argPos) || message.HasCharPrefix(prefix, ref argPos)))
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user