Exemplo n.º 1
0
        /// <summary>
        /// Creates an <see cref="IAdapter"/> that update your guild count when <see cref="IAdapter.UpdateAsync"/> is invoked.
        /// </summary>
        /// <param name="interval">The interval that this <see cref="IAdapter"/> will update. Leave empty to update on each guild event.</param>
        /// <param name="runMode">The run mode that this <see cref="IAdapter"/> should run as.</param>
        /// <returns>A new <see cref="IAdapter"/> instance that will update your guild count when <see cref="IAdapter.UpdateAsync"/> is invoked.</returns>
        public virtual IAdapter CreateListenAdapter(TimeSpan?interval = null, AdapterRunMode runMode = AdapterRunMode.Sync)
        {
            if (Client is BaseSocketClient socketClient)
            {
                return(new SocketSubmissionAdapter(this, socketClient, new AdapterProperties(interval ?? TimeSpan.Zero, runMode)));
            }

            return(new SubmissionAdapter(this, Client, new AdapterProperties(interval ?? TimeSpan.Zero, runMode)));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new <see cref="AdapterProperties"/>.
 /// </summary>
 /// <param name="interval">The interval at which an <see cref="IAdapter"/> should update.</param>
 /// <param name="runMode">The run mode for an <see cref="IAdapter"/>.</param>
 /// <param name="message">The message that is sent whenever an <see cref="IAdapter"/> is updated.</param>
 public AdapterProperties(TimeSpan interval, AdapterRunMode runMode = AdapterRunMode.Sync, string message = null)
 {
     Interval = interval;
     RunMode  = runMode;
     Message  = message ?? Default.Message;
 }