private async Task ConfigCmd(CommandContext ctx, SnowflakeObject target, string element) { if (ctx.Channel.Get(ConfigManager.Enabled).True()) { await ctx.TriggerTypingAsync(); if (string.Equals(element, ConfigManager.Prefix, StringComparison.CurrentCultureIgnoreCase)) { await ctx.RespondAsync( $"{element}: {target.Get(element, target is DiscordGuild ? Common.Prefix : ((DiscordChannel) target).Guild.Get(ConfigManager.Prefix, Common.Prefix))}"); } else { if (!CommandArr.GetCommandNames().Contains(element)) { throw new ArgumentException($"Element ({element}) not in CommandArr"); } await ctx.RespondAsync($"{element}: {target.Get(element)}"); } } }
public static bool?Get(this SnowflakeObject id, string element, bool?defaultVal = true) => GenericExtensions.ParseBool(id.Get(element, defaultVal.GetString()));