public static async Task RefreshData(SocketCommandContext context) { string emoji = Constants.EMOJI_THUMBSUP; string title = "Success"; string body = Constants.COMMAND_REFRESH_SUCCESSFUL; try { Sitemap.ReloadData(); BlockedDomains.ReloadData(); HassBotCommands.ReloadData(); } catch { emoji = Constants.EMOJI_FAIL; title = "Failed"; body = Constants.COMMAND_REFRESH_FAILED; } // Send response await Helper.CreateEmbed(context, emoji, title, body, forceremoveoriginalmessage : true); }
public static async Task RefreshData(SocketCommandContext context) { var embed = new EmbedBuilder(); try { Sitemap.ReloadData(); BlockedDomains.ReloadData(); HassBotCommands.ReloadData(); } catch { embed.WithColor(Color.Red); embed.AddInlineField(Constants.EMOJI_FAIL, Constants.COMMAND_REFRESH_FAILED); await context.Channel.SendMessageAsync(string.Empty, false, embed); return; } embed.WithColor(Helper.GetRandomColor()); embed.AddInlineField(Constants.EMOJI_THUMBSUP, Constants.COMMAND_REFRESH_SUCCESSFUL); await context.Channel.SendMessageAsync(string.Empty, false, embed); }