/// <summary> /// Instantiates the MpGameService for the specified Game type. /// </summary> /// <param name="client"> /// The Discord client. /// </param> /// <param name="mpconfig"> /// An optional config type. /// </param> /// <param name="logger"> /// An optional logging method. /// </param> public MpGameService( BaseSocketClient client, IMpGameServiceConfig mpconfig = null, Func <LogMessage, Task> logger = null) : base(client, mpconfig, logger) { }
/// <summary> /// Instantiates the MpGameService for the specified Game and Player type. /// </summary> /// <param name="client"> /// The Discord client. /// </param> /// <param name="mpconfig"> /// An optional config type. /// </param> /// <param name="logger"> /// An optional logging method. /// </param> public MpGameService( BaseSocketClient client, IMpGameServiceConfig?mpconfig = null, Func <LogMessage, Task>?logger = null) { _client = client ?? throw new ArgumentNullException(nameof(client)); _mpconfig = mpconfig ?? #if NETCOREAPP3_0 IMpGameServiceConfig.Default; #else IMpGameServiceConfig.DefaultConfig.Instance; #endif Logger = logger ?? Extensions.NoOpLogger; Logger(new LogMessage(LogSeverity.Debug, LogSource, _mpconfig.LogStrings.LogRegistration(_gameName))); client.ChannelDestroyed += CheckDestroyedChannel; }
/// <summary> /// Instantiates the MpGameService for the specified Game and Player type. /// </summary> /// <param name="client"> /// The Discord client. /// </param> /// <param name="mpconfig"> /// An optional config type. /// </param> /// <param name="logger"> /// An optional logging method. /// </param> public MpGameService( #if TEST IDiscordClient iclient, #else BaseSocketClient client, #endif IMpGameServiceConfig mpconfig = null, Func <LogMessage, Task> logger = null) { _mpconfig = mpconfig ?? DefaultConfig.Instance; Logger = logger ?? Extensions.NoOpLogger; Logger(new LogMessage(LogSeverity.Debug, LogSource, _mpconfig.LogStrings.LogRegistration(_gameName))); #if TEST if (iclient is BaseSocketClient client) #endif client.ChannelDestroyed += CheckDestroyedChannel; }