/// <summary>
 /// Sends an error message to the specified channel.
 /// </summary>
 public static async Task <IUserMessage> ThrowAsync(this IMessageChannel channel,
                                                    string error,
                                                    RequestOptions options          = null,
                                                    AllowedMentions allowedMentions = null)
 {
     return(await channel.SendMessageAsync(Format.Error("Oops!", "An error has occurred.", error), options : options, allowedMentions : allowedMentions));
 }
Example #2
0
        public Message(ErrorMessageBuilder builder)
        {
            if (Check.NotNull(builder.Color))
            {
                EmbedBuilder embed = new EmbedBuilder();

                embed.WithColor(builder.Color);

                if (Check.NotNull(builder.Reaction))
                {
                    embed.WithTitle(Discord.Format.Bold(builder.Reaction));
                }

                embed.WithDescription(Format.Error(builder.Reaction, builder.Title, builder.Reason, builder.StackTrace, Check.NotNull(builder.Color)));

                Embed = embed.Build();
            }
            else
            {
                Text = Format.Error(builder.Reaction, builder.Title, builder.Reason, builder.StackTrace);
            }
        }