public Builder(EmbedResponseTemplate template) { response = EmbedResponseTemplateFactory.CreateFromTemplate(template); if (response.messages == null) { this.messages = new List <Message>(); } else { this.messages = new List <Message>(response.messages); } }
private static uint GetTemplateColor(EmbedResponseTemplate template) { switch (template) { case EmbedResponseTemplate.Warning: return(COLOR_YELLOW); case EmbedResponseTemplate.Error: case EmbedResponseTemplate.Failure: return(COLOR_RED); case EmbedResponseTemplate.Success: return(COLOR_GREEN); default: return(COLOR_DEFAULT); } }
internal static EmbedResponse CreateFromTemplate(EmbedResponseTemplate template) { EmbedResponse embedResponse = new EmbedResponse(); if ((int)template >= TEMPLATE_SYSTEM_MESSAGE_START && (int)template <= TEMPLATE_SYSTEM_MESSAGE_END) { embedResponse.Author = TamaChan.Instance.botSettings.botName; if (TamaChan.Instance.GetSelf() == null) { embedResponse.IconUrl = "%SELF%"; } else { embedResponse.IconUrl = TamaChan.Instance.GetSelf().GetAvatarUrl(Discord.ImageFormat.Auto, 64); } } embedResponse.Title = GetTemplateTitle(template); embedResponse.Color = GetTemplateColor(template); return(embedResponse); }
private static string GetTemplateTitle(EmbedResponseTemplate template) { switch (template) { case EmbedResponseTemplate.Warning: return(TITLE_WARNING); case EmbedResponseTemplate.Error: return(TITLE_ERROR); case EmbedResponseTemplate.Info: return(TITLE_INFO); case EmbedResponseTemplate.Success: return(TITLE_SUCCESS); case EmbedResponseTemplate.Failure: return(TITLE_FAILURE); default: return(string.Empty); } }