public void AddIdToWhitelistForCommandOrModule(GuildAccount guild, string input, ulong id, bool isChannel) { var result = _commands.AdvancedSearch(input); if (result.Module is null) { guild.AddToWhitelist(_commands.FormatCommandName(result.Command), id, isChannel); } else { AddIdToWhitelistForModule(guild, result.Module, id, isChannel); } }
private void AddIdToWhitelistForModule(GuildAccount guild, ModuleInfo module, ulong id, bool isChannel) { for (int i = 0; i < module.Commands.Count; i++) { var cmd = module.Commands[i]; guild.AddToWhitelist(_commands.FormatCommandName(cmd), id, isChannel); } for (int i = 0; i < module.Submodules.Count; i++) { AddIdToWhitelistForModule(guild, module.Submodules[i], id, isChannel); } }