Exemplo n.º 1
0
 /// <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)
 {
 }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
        /// <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;
        }