Beispiel #1
0
        /// <inheritdoc />
        public async Task <EmbedBuilder> RegisterRemovableMessageAsync(IMessage message, IUser user, EmbedBuilder embed)
        {
            await NotificationDispatchService.PublishScopedAsync(new RemovableMessageSent()
            {
                Message = message,
                User    = user,
            });

            if (embed.Footer != null)
            {
                embed.Footer.Text += $" | {_footerReactMessage}";
            }
            else
            {
                embed.WithFooter(_footerReactMessage);
            }
            return(embed);
        }
        /// <inheritdoc />
        public async Task RegisterRemovableMessageAsync(IUser user, EmbedBuilder embed, Func <EmbedBuilder, Task <IUserMessage> > callback)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            if (embed.Footer == null)
            {
                embed.WithFooter(_footerReactMessage);
            }
            else if (!embed.Footer.Text.Contains(_footerReactMessage))
            {
                embed.Footer.Text += $" | {_footerReactMessage}";
            }

            var msg = await callback.Invoke(embed);

            await NotificationDispatchService.PublishScopedAsync(new RemovableMessageSent()
            {
                Message = msg,
                User    = user,
            });
        }
 /// <inheritdoc />
 public async Task UnregisterRemovableMessageAsync(IMessage message)
 => await NotificationDispatchService.PublishScopedAsync(new RemovableMessageRemoved()
 {
     Message = message,
 });
 /// <inheritdoc />
 public async Task RegisterRemovableMessageAsync(IMessage message, IUser user)
 => await NotificationDispatchService.PublishScopedAsync(new RemovableMessageSent()
 {
     Message = message,
     User    = user,
 });