public static EmbedBuilder WithColorType(this EmbedBuilder builder, EmbedColorType colorType) { switch (colorType) { case EmbedColorType.Warning: return(builder.WithColor(MessageSender.SColorWarning)); case EmbedColorType.Danger: return(builder.WithColor(MessageSender.SColorDanger)); case EmbedColorType.Special: return(builder.WithColor(MessageSender.SColorSpecial)); case EmbedColorType.Good: default: return(builder); } }
public static KuuhakuEmbedBuilder WithColor(this KuuhakuEmbedBuilder embed, EmbedColorType type = EmbedColorType.Default) => embed.WithColor(EmbedColorTypeMap[type]);
public async Task <IUserMessage> SendAsync(IChannel c, string header, string content, EmbedColorType colorType = EmbedColorType.Good, IMessage msg = null) { try { if (string.IsNullOrWhiteSpace(content)) { return(null); } IMessageChannel chan = c as IMessageChannel; if (!this.CanSendMessage(chan)) { return(null); } EmbedBuilder builder = new EmbedBuilder(); builder .WithColorType(colorType) .WithLimitedDescription(content) .WithFooter(header); if (msg != null) { builder.WithAuthorNickname(msg); } return(await chan.SendMessageAsync(string.Empty, false, builder.Build())); } catch (Exception ex) { this.LogFailedMessage(c, ex); } return(null); }
public async Task <IUserMessage> SendAsync(IMessage msg, string header, string content, EmbedColorType colorType = EmbedColorType.Good) => await this.SendAsync(msg.Channel, header, content, colorType, msg);