public async Task SendEmbedAndDeleteAsync
        (
            [NotNull] IMessageChannel channel,
            [NotNull] Embed eb,
            TimeSpan?timeout = null
        )
        {
            timeout ??= TimeSpan.FromSeconds(15.0);

            var message = await channel.SendMessageAsync(string.Empty, embed : eb);

            _delayedActions.DelayUntil(() => message.DeleteAsync(), timeout.Value);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Sends an interactive message to the given channel and deletes it after a certain timeout.
        /// </summary>
        /// <param name="channel">The channel to send the message to.</param>
        /// <param name="message">The message to send.</param>
        /// <param name="timeout">The timeout after which the embed will be deleted. Defaults to 15 seconds.</param>
        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
        public async Task SendInteractiveMessageAndDeleteAsync
        (
            [NotNull] IMessageChannel channel,
            [NotNull] IInteractiveMessage message,
            [CanBeNull] TimeSpan?timeout = null
        )
        {
            timeout = timeout ?? TimeSpan.FromSeconds(15.0);

            _trackedMessages.Add(message);
            await message.SendAsync(this, channel);

            _delayedActions.DelayUntil(() => DeleteInteractiveMessageAsync(message), timeout.Value);
        }